|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--JProjects.eab.data.DatastoreJDBC
Datastore JDBC objects represent datastore connections. This class manages these connections by providing client connection to the database, disconnection from the database, and the ability to commit and roll back database transactions.
Field Summary | |
protected ConnectionSupport |
_connectSupport
|
static int |
TRANSACTION_NONE
|
static int |
TRANSACTION_NOT_SET
|
static int |
TRANSACTION_READ_COMMITTED
|
static int |
TRANSACTION_READ_UNCOMMITTED
|
static int |
TRANSACTION_REPEATABLE_READ
|
static int |
TRANSACTION_SERIALIZABLE
|
Constructor Summary | |
DatastoreJDBC()
This is the default constructor. |
|
DatastoreJDBC(java.lang.String url)
This constructor allows you to specify a URL that points to the database you want to connect to. |
|
DatastoreJDBC(java.lang.String url,
java.util.Properties prop)
This constructor allows you to specify a URL that points to the datastore you want to connect to, and the properties information (user ID and password) for the datastore connection. |
Method Summary | |
void |
_executeAction(java.lang.String acnN,
java.lang.Object[] params)
|
void |
_handleException(java.lang.Exception ex)
|
protected void |
_loadDriver()
|
protected boolean |
_onBackground()
|
protected void |
_putOnBackgroundThread(java.lang.String acnN,
java.lang.Object[] params)
|
protected void |
_setBusy(boolean flag)
|
void |
addConnectionListener(ConnectionListener l)
Use this method to register a listener for connection events. |
void |
cancel()
This method cancels the method (for example, a database query) that is currently running. |
void |
commit()
This method commits the current set of transations to the database. |
void |
connect()
This method establishes a client connection to the current datastore object using default settings for the object's attributes. |
void |
connect(java.lang.String usr,
java.lang.String passwd)
This method establishes a client connection to the current datastore object using the passed-in user name and password. |
void |
disconnect()
This method closes the connection to the datastore. |
void |
executeSQL(java.lang.String qry)
This method executes the passed-in SQL statement in the current datastore. |
void |
finalize()
This override of the Object finalize method checks to see if the connection object is closed, and if it is not, closes it. |
static DatastoreJDBC |
getApplicationDatastore()
This method gets the datastore object that has been set as default for the application. |
java.sql.Connection |
getConnection()
This method returns a java.sql.Connection object that represents the client connection to the current datastore object. |
java.lang.String |
getDriver()
This method gets the JDBC driver setting of the current datastore. |
java.util.Properties |
getProperties()
This method gets the properties of the current datastore. |
int |
getTransactionIsolation()
This method gets the current connection object's transaction isolation level. |
java.lang.String |
getURL()
This method gets the URL used by the current connection. |
boolean |
isAsynchronous()
This method tells you whether methods are set to run on a background thread or not. |
boolean |
isAutoCommit()
This method queries the current connection object's auto-commit setting. |
boolean |
isBusy()
This method tells you whether the object is running a method in the background. |
boolean |
isConnected()
This method queries whether there is a connection established to the database. |
boolean |
isReadOnly()
This method returns a boolean indicating the read/write status of the datastore. |
void |
removeConnectionListener(ConnectionListener l)
Use this method to remove the listener on the connection object. |
void |
rollback()
This method rolls back all transactions since the last successful commit. |
static void |
setApplicationDatastore(DatastoreJDBC ds)
This method sets the application's default datastore to the passed-in datastore. |
void |
setAsApplicationDatastore()
Use this method to set the application's default datastore to the current DatastoreJDBC object. |
void |
setAsynchronous(boolean isAs)
This method lets you set whether the database methods are run on a background thread. |
void |
setAutoCommit(boolean flag)
This method lets you set the current connection object so that it automatically commits all transactions. |
void |
setConnection(java.sql.Connection con)
Sets connection for this datastore object. |
void |
setDriver(java.lang.String drvName)
This method sets the JDBC driver for the database to which you want to connect. |
void |
setProperties(java.util.Properties prop)
This method uses the passed-in Properties object to set the user ID and password properties of the current datastore. |
void |
setReadOnly(boolean flag)
This method allows you to change the read/write access for the current datastore connection. |
void |
setTransactionIsolation(int level)
This method sets the current connection object's isolation level to the level you pass in. |
void |
setURL(java.lang.String url)
This method sets the URL for the database to which you want to connect. |
java.lang.String |
toString()
This method outputs a string indicating URL for the current database. |
Methods inherited from class java.lang.Object |
clone,
equals,
getClass,
hashCode,
notify,
notifyAll,
wait,
wait,
wait |
Field Detail |
public static final int TRANSACTION_NONE
public static final int TRANSACTION_READ_UNCOMMITTED
public static final int TRANSACTION_READ_COMMITTED
public static final int TRANSACTION_REPEATABLE_READ
public static final int TRANSACTION_SERIALIZABLE
public static final int TRANSACTION_NOT_SET
protected transient ConnectionSupport _connectSupport
Constructor Detail |
public DatastoreJDBC()
public DatastoreJDBC(java.lang.String url)
url
- - URL of the Database.public DatastoreJDBC(java.lang.String url, java.util.Properties prop)
url
- - URL of the Database.prop
- - Properties for the database connection.Method Detail |
public void _executeAction(java.lang.String acnN, java.lang.Object[] params) throws java.lang.Exception
public void _handleException(java.lang.Exception ex)
public void addConnectionListener(ConnectionListener l)
l
- a ConnectionListener to listen for connection events.public void cancel() throws DAException
public void commit() throws DAException
public void connect() throws DAException, java.lang.ClassNotFoundException
public void connect(java.lang.String usr, java.lang.String passwd) throws DAException, java.lang.ClassNotFoundException
usr
- - user's name known to the Database server.passwd
- - user's password.public void disconnect() throws DAException
public void executeSQL(java.lang.String qry) throws DAException
qry
- - SQL statement.public void finalize()
public static DatastoreJDBC getApplicationDatastore()
public java.sql.Connection getConnection()
public void setConnection(java.sql.Connection con)
con
- - established client connection to the Database.public java.lang.String getDriver()
public java.util.Properties getProperties()
public int getTransactionIsolation() throws DAException
public java.lang.String getURL()
public boolean isAsynchronous()
public boolean isAutoCommit() throws DAException
public boolean isBusy()
public boolean isConnected()
public boolean isReadOnly() throws DAException
public void removeConnectionListener(ConnectionListener l)
l
- - ConnectionListener object to remove.public void rollback() throws DAException
public static void setApplicationDatastore(DatastoreJDBC ds)
public void setAsApplicationDatastore()
public void setAsynchronous(boolean isAs)
public void setAutoCommit(boolean flag) throws DAException
public void setDriver(java.lang.String drvName)
public void setProperties(java.util.Properties prop)
public void setReadOnly(boolean flag) throws DAException
public void setTransactionIsolation(int level) throws DAException
public void setURL(java.lang.String url)
public java.lang.String toString()
protected void _loadDriver() throws java.lang.ClassNotFoundException
protected boolean _onBackground()
protected void _putOnBackgroundThread(java.lang.String acnN, java.lang.Object[] params)
protected void _setBusy(boolean flag)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |