|
|||||||||
Home >> All >> openfuture >> util >> [ database overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: ![]() ![]() ![]() |
DETAIL: FIELD | CONSTR | METHOD |
openfuture.util.database
Class DBServer

java.lang.Objectopenfuture.util.database.DBServer
- Direct Known Subclasses:
- HyperSQLServer, MySqlServer
- public abstract class DBServer
- extends java.lang.Object
Abstract JDBC database server.
Created: Tue Feb 08 05:52:56 2000
- Version:
- $Revision: 1.3 $
Field Summary | |
static java.lang.String |
AUTO_INCREMENT
Datatype AUTO_INCREMENT . |
static java.lang.String |
BLOB
Datatype BLOB . |
private java.sql.Connection |
connection
|
private java.sql.Driver |
driver
|
static java.lang.String |
LAST_INSERT_ID
Datatype LAST_INSERT_ID . |
private java.lang.String |
password
|
private java.lang.String |
url
|
private java.lang.String |
user
|
protected static java.lang.String[] |
usertables
|
Constructor Summary | |
DBServer()
|
Method Summary | |
protected abstract void |
checkDriver()
Check, if a driver is already registered. |
java.sql.Connection |
createConnection(java.lang.String user,
java.lang.String password)
Create a new connection to the database. |
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. |
protected void |
finalize()
Called on an object by the Virtual Machine at most once, at some point after the Object is determined unreachable but before it is destroyed. |
java.sql.Connection |
getConnection(java.lang.String user,
java.lang.String password)
Get the of connection to the database. |
java.sql.Driver |
getDriver()
Get the value of driver. |
java.lang.String |
getPassword()
Get the value of password. |
java.lang.String |
getUser()
Get the value of user. |
void |
init(java.lang.String url)
Initialize the database pointed at by url |
void |
setConnection(java.sql.Connection v)
Set the value of connection. |
void |
setDriver(java.sql.Driver v)
Set the value of driver. |
void |
setPassword(java.lang.String v)
Set the value of password. |
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. |
static 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, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
BLOB
public static final java.lang.String BLOB
- Datatype
BLOB
.- See Also:
- Constant Field Values
LAST_INSERT_ID
public static final java.lang.String LAST_INSERT_ID
- Datatype
LAST_INSERT_ID
.- See Also:
- Constant Field Values
AUTO_INCREMENT
public static final java.lang.String AUTO_INCREMENT
- Datatype
AUTO_INCREMENT
.- See Also:
- Constant Field Values
url
private java.lang.String url
user
private java.lang.String user
password
private java.lang.String password
connection
private java.sql.Connection connection
driver
private java.sql.Driver driver
usertables
protected static final java.lang.String[] usertables
Constructor Detail |
DBServer
public DBServer()
Method Detail |
init
public void init(java.lang.String url)
- Initialize the database pointed at by url
getConnection
public java.sql.Connection getConnection(java.lang.String user, java.lang.String password) throws java.sql.SQLException
- Get the of connection to the database. If the user/password
have changed since the last connection, a new connection
is established.
setConnection
public void setConnection(java.sql.Connection v)
- Set the value of connection.
createConnection
public java.sql.Connection createConnection(java.lang.String user, java.lang.String password) throws java.sql.SQLException
- Create a new connection to the database.
getUser
public java.lang.String getUser()
- Get the value of user.
setUser
public void setUser(java.lang.String v)
- Set the value of user.
getPassword
public java.lang.String getPassword()
- Get the value of password.
setPassword
public void setPassword(java.lang.String v)
- Set the value of password.
getDriver
public java.sql.Driver getDriver()
- Get the value of driver.
setDriver
public void setDriver(java.sql.Driver v)
- Set the value of driver.
sqlTranslate
public java.lang.String sqlTranslate(java.lang.String s)
- Translate SQL constructs into database specific syntax.
This method implements the identity. Override this method in
super classes for database specifics.
tableExists
public static boolean tableExists(java.sql.Connection connection, java.lang.String name)
- Check, if the table
name
exists. In order to check this, theconnection
is used.
executeIndexedQuery
public java.lang.Integer executeIndexedQuery(java.sql.Statement statement, java.lang.String sqlcommand) throws java.sql.SQLException
- Execute an SQL query, that inserts a row into a table with
an auto increment column.
finalize
protected void finalize() throws java.lang.Throwable
- Description copied from class:
java.lang.Object
- Called on an object by the Virtual Machine at most once,
at some point after the Object is determined unreachable
but before it is destroyed. You would think that this
means it eventually is called on every Object, but this is
not necessarily the case. If execution terminates
abnormally, garbage collection does not always happen.
Thus you cannot rely on this method to always work.
For finer control over garbage collection, use references
from the
java.lang.ref
package.Virtual Machines are free to not call this method if they can determine that it does nothing important; for example, if your class extends Object and overrides finalize to do simply
super.finalize()
.finalize() will be called by a java.lang.Thread that has no locks on any Objects, and may be called concurrently. There are no guarantees on the order in which multiple objects are finalized. This means that finalize() is usually unsuited for performing actions that must be thread-safe, and that your implementation must be use defensive programming if it is to always work.
If an Exception is thrown from finalize() during garbage collection, it will be patently ignored and the Object will still be destroyed.
It is allowed, although not typical, for user code to call finalize() directly. User invocation does not affect whether automatic invocation will occur. It is also permitted, although not recommended, for a finalize() method to "revive" an object by making it reachable from normal code again.
Unlike constructors, finalize() does not get called for an object's superclass unless the implementation specifically calls
super.finalize()
.The default implementation does nothing.
checkDriver
protected abstract void checkDriver() throws java.sql.SQLException
- Check, if a driver is already registered. If not, register
the specific driver.
|
|||||||||
Home >> All >> openfuture >> util >> [ database overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: ![]() ![]() ![]() |
DETAIL: FIELD | CONSTR | METHOD |