|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--openfuture.util.database.DBServer
Abstract JDBC database server.
Created: Tue Feb 08 05:52:56 2000
Field Summary | |
static java.lang.String |
AUTO_INCREMENT
Datatype AUTO_INCREMENT . |
static java.lang.String |
BLOB
Datatype BLOB . |
static java.lang.String |
LAST_INSERT_ID
Datatype LAST_INSERT_ID . |
protected static java.lang.String[] |
usertables
|
Constructor Summary | |
DBServer()
|
Method Summary | |
void |
closeConnection(java.sql.Connection con)
Close a database connection. |
void |
closeStatement(java.sql.Statement statement)
Close an SQL statement. |
void |
commitTransaction(java.sql.Connection con)
Commit the current transaction. |
java.lang.Integer |
executeIndexedQuery(java.sql.Statement statement,
java.lang.String sqlcommand)
Execute an SQL query, that inserts a row into a table with an auto increment column. |
java.sql.Connection |
getConnection()
Retrieve a new database connection. |
protected java.lang.String |
getPassword()
Get the value of password. |
protected java.lang.String |
getUrl()
Get the database connection string. |
protected java.lang.String |
getUser()
Get the value of user. |
abstract void |
init(java.lang.String url,
java.lang.String userid,
java.lang.String password)
Initialize the database pointed at by url for the given database driver |
protected void |
init(java.lang.String url,
java.lang.String driverClass,
java.lang.String userid,
java.lang.String password)
Initialize the database pointed at by url for the given database driver |
void |
openTransaction(java.sql.Connection con)
Open a new transaction. |
void |
rollbackTransaction(java.sql.Connection con)
Rollback the current transaction. |
protected void |
setPassword(java.lang.String v)
Set the value of password. |
protected void |
setUrl(java.lang.String newUrl)
Set the database connection string. |
protected void |
setUser(java.lang.String v)
Set the value of user. |
java.lang.String |
sqlTranslate(java.lang.String s)
Translate SQL constructs into database specific syntax. |
boolean |
tableExists(java.sql.Connection connection,
java.lang.String name)
Check, if the table name exists. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final java.lang.String BLOB
BLOB
.public static final java.lang.String LAST_INSERT_ID
LAST_INSERT_ID
.public static final java.lang.String AUTO_INCREMENT
AUTO_INCREMENT
.protected static final java.lang.String[] usertables
Constructor Detail |
public DBServer()
Method Detail |
public abstract void init(java.lang.String url, java.lang.String userid, java.lang.String password) throws I18NException
url
- URL of the database. The URL must be of the
form "jdbc:<database type>:<position>"userid
- database user ID for the database connectionpassword
- database user password for the database connectionI18NException
- if an error occursprotected void init(java.lang.String url, java.lang.String driverClass, java.lang.String userid, java.lang.String password) throws I18NException
url
- URL of the database. The URL must be of the
form "jdbc:<database type>:<position>"driverClass
- driver class name.userid
- database user ID for the database connectionpassword
- database user password for the database connectionI18NException
- if something went wrongpublic java.lang.String sqlTranslate(java.lang.String s)
s
- SQL textpublic boolean tableExists(java.sql.Connection connection, java.lang.String name)
name
exists. In order to check
this, the connection
is used.connection
- connection to the databasename
- table namepublic java.sql.Connection getConnection() throws I18NException
I18NException
- if an error occurspublic void closeConnection(java.sql.Connection con) throws I18NException
con
- the current database connectionI18NException
- if an error occurspublic void closeStatement(java.sql.Statement statement) throws I18NException
statement
- a Statement
valueI18NException
- if an error occurspublic void openTransaction(java.sql.Connection con) throws I18NException
con
- the current database connectionI18NException
- if an error occurspublic void rollbackTransaction(java.sql.Connection con) throws I18NException
con
- the current database connectionI18NException
- if an error occurspublic void commitTransaction(java.sql.Connection con) throws I18NException
con
- the current database connectionI18NException
- if an error occurspublic java.lang.Integer executeIndexedQuery(java.sql.Statement statement, java.lang.String sqlcommand) throws java.sql.SQLException
statement
- database statementsqlcommand
- command to be executedjava.sql.SQLException
- if an error occursprotected java.lang.String getUser()
protected void setUser(java.lang.String v)
v
- Value to assign to user.protected java.lang.String getPassword()
protected void setPassword(java.lang.String v)
v
- Value to assign to password.protected java.lang.String getUrl()
protected void setUrl(java.lang.String newUrl)
newUrl
- the new database connection string.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |