All Packages Class Hierarchy This Package Previous Next Index
Class JProjects.eab.data.DatastoreJDBC
java.lang.Object
|
+----JProjects.eab.data.DatastoreJDBC
- public class DatastoreJDBC
- extends Object
- implements Serializable, OnThreadActionExecutor
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.
- Author:
- Alexander Jaremenko < jarem@isb.gomel.by >
-
TRANSACTION_NONE
-
-
TRANSACTION_NOT_SET
-
-
TRANSACTION_READ_COMMITTED
-
-
TRANSACTION_READ_UNCOMMITTED
-
-
TRANSACTION_REPEATABLE_READ
-
-
TRANSACTION_SERIALIZABLE
-
-
DatastoreJDBC()
- This is the default constructor.
-
DatastoreJDBC(String)
- This constructor allows you to specify a URL that points to the database
you want to connect to.
-
DatastoreJDBC(String, Properties)
- 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.
-
_executeAction(String, Object[])
-
-
_handleException(Exception)
-
-
addConnectionListener(ConnectionListener)
- Use this method to register a listener for connection events.
-
cancel()
- This method cancels the method (for example, a database query) that
is currently running.
-
commit()
- This method commits the current set of transations to the database.
-
connect()
- This method establishes a client connection to the current datastore
object using default settings for the object's attributes.
-
connect(String, String)
- This method establishes a client connection to the current datastore
object using the passed-in user name and password.
-
disconnect()
- This method closes the connection to the datastore.
-
executeSQL(String)
- This method executes the passed-in SQL statement in the current datastore.
-
finalize()
- This override of the Object finalize method checks to see if the
connection object is closed, and if it is not, closes it.
-
getApplicationDatastore()
- This method gets the datastore object that has been set as default for the
application.
-
getConnection()
- This method returns a java.sql.Connection object that
represents the client connection to the current datastore object.
-
getDriver()
- This method gets the JDBC driver setting of the current datastore.
-
getProperties()
- This method gets the properties of the current datastore.
-
getTransactionIsolation()
- This method gets the current connection object's transaction isolation
level.
-
getURL()
- This method gets the URL used by the current connection.
-
isAsynchronous()
- This method tells you whether methods are set to run on a background thread
or not.
-
isAutoCommit()
- This method queries the current connection object's auto-commit setting.
-
isBusy()
- This method tells you whether the object is running a method in the background.
-
isConnected()
- This method queries whether there is a connection established to the database.
-
isReadOnly()
- This method returns a boolean indicating the read/write status of the
datastore.
-
removeConnectionListener(ConnectionListener)
- Use this method to remove the listener on the connection object.
-
rollback()
- This method rolls back all transactions since the last successful commit.
-
setApplicationDatastore(DatastoreJDBC)
- This method sets the application's default datastore to the passed-in
datastore.
-
setAsApplicationDatastore()
- Use this method to set the application's default datastore to the current
DatastoreJDBC object.
-
setAsynchronous(boolean)
- This method lets you set whether the database methods are run on a
background thread.
-
setAutoCommit(boolean)
- This method lets you set the current connection object so that it
automatically commits all transactions.
-
setConnection(Connection)
- Sets connection for this datastore object.
-
setDriver(String)
- This method sets the JDBC driver for the database to which you want to
connect.
-
setProperties(Properties)
- This method uses the passed-in Properties object to set the user ID and
password properties of the current datastore.
-
setReadOnly(boolean)
- This method allows you to change the read/write access for the current
datastore connection.
-
setTransactionIsolation(int)
- This method sets the current connection object's isolation level to the
level you pass in.
-
setURL(String)
- This method sets the URL for the database to which you want to connect.
-
toString()
- This method outputs a string indicating URL for the current database.
TRANSACTION_NONE
public static final int TRANSACTION_NONE
TRANSACTION_READ_UNCOMMITTED
public static final int TRANSACTION_READ_UNCOMMITTED
TRANSACTION_READ_COMMITTED
public static final int TRANSACTION_READ_COMMITTED
TRANSACTION_REPEATABLE_READ
public static final int TRANSACTION_REPEATABLE_READ
TRANSACTION_SERIALIZABLE
public static final int TRANSACTION_SERIALIZABLE
TRANSACTION_NOT_SET
public static final int TRANSACTION_NOT_SET
DatastoreJDBC
public DatastoreJDBC()
- This is the default constructor.
DatastoreJDBC
public DatastoreJDBC(String url)
- This constructor allows you to specify a URL that points to the database
you want to connect to.
- Parameters:
- url - - URL of the Database.
DatastoreJDBC
public DatastoreJDBC(String url,
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.
- Parameters:
- url - - URL of the Database.
- prop - - Properties for the database connection.
_executeAction
public void _executeAction(String acnN,
Object params[]) throws Exception
_handleException
public void _handleException(Exception ex)
addConnectionListener
public void addConnectionListener(ConnectionListener l)
- Use this method to register a listener for connection events.
- Parameters:
- l - a ConnectionListener to listen for connection events.
cancel
public void cancel() throws DAException
- This method cancels the method (for example, a database query) that
is currently running.
- Throws: DAException
- - if data access error occur.
commit
public void commit() throws DAException
- This method commits the current set of transations to the database.
- Throws: DAException
- - if data access error occur.
connect
public void connect() throws DAException, ClassNotFoundException
- This method establishes a client connection to the current datastore
object using default settings for the object's attributes.
- Throws: DAException
- - if data access error occur.
- Throws: ClassNotFoundException
- - if fail register driver for default URL.
connect
public void connect(String usr,
String passwd) throws DAException, ClassNotFoundException
- This method establishes a client connection to the current datastore
object using the passed-in user name and password.
- Parameters:
- usr - - user's name known to the Database server.
- passwd - - user's password.
- Throws: DAException
- - if data access error occur.
- Throws: ClassNotFoundException
- - if fail register driver for default URL.
disconnect
public void disconnect() throws DAException
- This method closes the connection to the datastore.
- Throws: DAException
- - if data access error occur.
executeSQL
public void executeSQL(String qry) throws DAException
- This method executes the passed-in SQL statement in the current datastore.
- Parameters:
- qry - - SQL statement.
- Throws: DAException
- - if data access error occur.
finalize
public 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.
- Overrides:
- finalize in class Object
getApplicationDatastore
public static DatastoreJDBC getApplicationDatastore()
- This method gets the datastore object that has been set as default for the
application.
getConnection
public Connection getConnection()
- This method returns a java.sql.Connection object that
represents the client connection to the current datastore object.
setConnection
public void setConnection(Connection con)
- Sets connection for this datastore object.
- Parameters:
- con - - established client connection to the Database.
getDriver
public String getDriver()
- This method gets the JDBC driver setting of the current datastore.
getProperties
public Properties getProperties()
- This method gets the properties of the current datastore.
getTransactionIsolation
public int getTransactionIsolation() throws DAException
- This method gets the current connection object's transaction isolation
level.
- Throws: DAException
- - if data access error occur.
getURL
public String getURL()
- This method gets the URL used by the current connection.
isAsynchronous
public boolean isAsynchronous()
- This method tells you whether methods are set to run on a background thread
or not.
isAutoCommit
public boolean isAutoCommit() throws DAException
- This method queries the current connection object's auto-commit setting.
- Returns:
- true if this connection is in autocommit mode.
- Throws: DAException
- - if data access error occur.
isBusy
public boolean isBusy()
- This method tells you whether the object is running a method in the background.
isConnected
public boolean isConnected()
- This method queries whether there is a connection established to the database.
isReadOnly
public boolean isReadOnly() throws DAException
- This method returns a boolean indicating the read/write status of the
datastore.
- Throws: DAException
- - if data access error occur.
removeConnectionListener
public void removeConnectionListener(ConnectionListener l)
- Use this method to remove the listener on the connection object.
- Parameters:
- l - - ConnectionListener object to remove.
rollback
public void rollback() throws DAException
- This method rolls back all transactions since the last successful commit.
- Throws: DAException
- - if data access error occur.
setApplicationDatastore
public static void setApplicationDatastore(DatastoreJDBC ds)
- This method sets the application's default datastore to the passed-in
datastore.
setAsApplicationDatastore
public void setAsApplicationDatastore()
- Use this method to set the application's default datastore to the current
DatastoreJDBC object.
setAsynchronous
public void setAsynchronous(boolean isAs)
- This method lets you set whether the database methods are run on a
background thread.
setAutoCommit
public void setAutoCommit(boolean flag) throws DAException
- This method lets you set the current connection object so that it
automatically commits all transactions.
- Throws: DAException
- - if data access error occur.
setDriver
public void setDriver(String drvName)
- This method sets the JDBC driver for the database to which you want to
connect.
setProperties
public void setProperties(Properties prop)
- This method uses the passed-in Properties object to set the user ID and
password properties of the current datastore.
setReadOnly
public void setReadOnly(boolean flag) throws DAException
- This method allows you to change the read/write access for the current
datastore connection.
- Throws: DAException
- - if data access error occur.
setTransactionIsolation
public void setTransactionIsolation(int level) throws DAException
- This method sets the current connection object's isolation level to the
level you pass in.
- Throws: DAException
- - if data access error occur.
setURL
public void setURL(String url)
- This method sets the URL for the database to which you want to connect.
toString
public String toString()
- This method outputs a string indicating URL for the current database.
- Overrides:
- toString in class Object
All Packages Class Hierarchy This Package Previous Next Index