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 >

Variable Index

 o TRANSACTION_NONE
 o TRANSACTION_NOT_SET
 o TRANSACTION_READ_COMMITTED
 o TRANSACTION_READ_UNCOMMITTED
 o TRANSACTION_REPEATABLE_READ
 o TRANSACTION_SERIALIZABLE

Constructor Index

 o DatastoreJDBC()
This is the default constructor.
 o DatastoreJDBC(String)
This constructor allows you to specify a URL that points to the database you want to connect to.
 o 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.

Method Index

 o _executeAction(String, Object[])
 o _handleException(Exception)
 o addConnectionListener(ConnectionListener)
Use this method to register a listener for connection events.
 o cancel()
This method cancels the method (for example, a database query) that is currently running.
 o commit()
This method commits the current set of transations to the database.
 o connect()
This method establishes a client connection to the current datastore object using default settings for the object's attributes.
 o connect(String, String)
This method establishes a client connection to the current datastore object using the passed-in user name and password.
 o disconnect()
This method closes the connection to the datastore.
 o executeSQL(String)
This method executes the passed-in SQL statement in the current datastore.
 o finalize()
This override of the Object finalize method checks to see if the connection object is closed, and if it is not, closes it.
 o getApplicationDatastore()
This method gets the datastore object that has been set as default for the application.
 o getConnection()
This method returns a java.sql.Connection object that represents the client connection to the current datastore object.
 o getDriver()
This method gets the JDBC driver setting of the current datastore.
 o getProperties()
This method gets the properties of the current datastore.
 o getTransactionIsolation()
This method gets the current connection object's transaction isolation level.
 o getURL()
This method gets the URL used by the current connection.
 o isAsynchronous()
This method tells you whether methods are set to run on a background thread or not.
 o isAutoCommit()
This method queries the current connection object's auto-commit setting.
 o isBusy()
This method tells you whether the object is running a method in the background.
 o isConnected()
This method queries whether there is a connection established to the database.
 o isReadOnly()
This method returns a boolean indicating the read/write status of the datastore.
 o removeConnectionListener(ConnectionListener)
Use this method to remove the listener on the connection object.
 o rollback()
This method rolls back all transactions since the last successful commit.
 o setApplicationDatastore(DatastoreJDBC)
This method sets the application's default datastore to the passed-in datastore.
 o setAsApplicationDatastore()
Use this method to set the application's default datastore to the current DatastoreJDBC object.
 o setAsynchronous(boolean)
This method lets you set whether the database methods are run on a background thread.
 o setAutoCommit(boolean)
This method lets you set the current connection object so that it automatically commits all transactions.
 o setConnection(Connection)
Sets connection for this datastore object.
 o setDriver(String)
This method sets the JDBC driver for the database to which you want to connect.
 o setProperties(Properties)
This method uses the passed-in Properties object to set the user ID and password properties of the current datastore.
 o setReadOnly(boolean)
This method allows you to change the read/write access for the current datastore connection.
 o setTransactionIsolation(int)
This method sets the current connection object's isolation level to the level you pass in.
 o setURL(String)
This method sets the URL for the database to which you want to connect.
 o toString()
This method outputs a string indicating URL for the current database.

Variables

 o TRANSACTION_NONE
 public static final int TRANSACTION_NONE
 o TRANSACTION_READ_UNCOMMITTED
 public static final int TRANSACTION_READ_UNCOMMITTED
 o TRANSACTION_READ_COMMITTED
 public static final int TRANSACTION_READ_COMMITTED
 o TRANSACTION_REPEATABLE_READ
 public static final int TRANSACTION_REPEATABLE_READ
 o TRANSACTION_SERIALIZABLE
 public static final int TRANSACTION_SERIALIZABLE
 o TRANSACTION_NOT_SET
 public static final int TRANSACTION_NOT_SET

Constructors

 o DatastoreJDBC
 public DatastoreJDBC()
This is the default constructor.

 o 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.
 o 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.

Methods

 o _executeAction
 public void _executeAction(String acnN,
                            Object params[]) throws Exception
 o _handleException
 public void _handleException(Exception ex)
 o 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.
 o 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.
 o commit
 public void commit() throws DAException
This method commits the current set of transations to the database.

Throws: DAException
- if data access error occur.
 o 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.
 o 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.
 o disconnect
 public void disconnect() throws DAException
This method closes the connection to the datastore.

Throws: DAException
- if data access error occur.
 o 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.
 o 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
 o getApplicationDatastore
 public static DatastoreJDBC getApplicationDatastore()
This method gets the datastore object that has been set as default for the application.

 o getConnection
 public Connection getConnection()
This method returns a java.sql.Connection object that represents the client connection to the current datastore object.

 o setConnection
 public void setConnection(Connection con)
Sets connection for this datastore object.

Parameters:
con - - established client connection to the Database.
 o getDriver
 public String getDriver()
This method gets the JDBC driver setting of the current datastore.

 o getProperties
 public Properties getProperties()
This method gets the properties of the current datastore.

 o getTransactionIsolation
 public int getTransactionIsolation() throws DAException
This method gets the current connection object's transaction isolation level.

Throws: DAException
- if data access error occur.
 o getURL
 public String getURL()
This method gets the URL used by the current connection.

 o isAsynchronous
 public boolean isAsynchronous()
This method tells you whether methods are set to run on a background thread or not.

 o 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.
 o isBusy
 public boolean isBusy()
This method tells you whether the object is running a method in the background.

 o isConnected
 public boolean isConnected()
This method queries whether there is a connection established to the database.

 o 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.
 o removeConnectionListener
 public void removeConnectionListener(ConnectionListener l)
Use this method to remove the listener on the connection object.

Parameters:
l - - ConnectionListener object to remove.
 o rollback
 public void rollback() throws DAException
This method rolls back all transactions since the last successful commit.

Throws: DAException
- if data access error occur.
 o setApplicationDatastore
 public static void setApplicationDatastore(DatastoreJDBC ds)
This method sets the application's default datastore to the passed-in datastore.

 o setAsApplicationDatastore
 public void setAsApplicationDatastore()
Use this method to set the application's default datastore to the current DatastoreJDBC object.

 o setAsynchronous
 public void setAsynchronous(boolean isAs)
This method lets you set whether the database methods are run on a background thread.

 o 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.
 o setDriver
 public void setDriver(String drvName)
This method sets the JDBC driver for the database to which you want to connect.

 o 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.

 o 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.
 o 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.
 o setURL
 public void setURL(String url)
This method sets the URL for the database to which you want to connect.

 o 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