|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.bankframe.ei.txnhandler.hostcache.Retry
com.bankframe.ei.txnhandler.hostcache.DataSourceWrapper
This class is a wrapper class used for connecting to a database. Depending on the Application servers differnet methods are required to connect to the database.
Constructor Summary | |
DataSourceWrapper(java.util.Hashtable env,
java.lang.String dataSourceName)
Creates new DataSourceWrapper |
Method Summary | |
void |
close()
This closes the member's connection. |
java.sql.Statement |
createStatement()
This method creates a statement from the DataSource. |
static java.sql.Connection |
getConnection(java.util.Hashtable env,
java.lang.String dataSourceName)
A static method for getting a JDBC connection from a DataSource. |
java.sql.DatabaseMetaData |
getMetaData()
This method gets the connection's meta data. |
void |
open()
This method opens the connection. |
java.sql.PreparedStatement |
prepareStatement(java.lang.String sql)
This method creates a prepared statement. |
java.sql.PreparedStatement |
prepareStatement(java.lang.String sql,
int resultSetType,
int resultSetConcurrency)
This method creates a prepared statement. |
boolean |
runRetry()
This is run on every retry. |
Methods inherited from class com.bankframe.ei.txnhandler.hostcache.Retry |
retry |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public DataSourceWrapper(java.util.Hashtable env, java.lang.String dataSourceName) throws java.sql.SQLException, javax.naming.NamingException
env
- The JNDI env.dataSourceName
- The DataSource JNDI name.
java.sql.SQLException
- If an error occurs during a database operation.
javax.naming.NamingException
- If there was a problem looking up the DataSource.Method Detail |
public java.sql.Statement createStatement() throws java.sql.SQLException, javax.naming.NamingException
java.sql.SQLException
- If an exception occurred in getting the statement.
javax.naming.NamingException
- If an exception occurred in opening the connection.public java.sql.PreparedStatement prepareStatement(java.lang.String sql) throws java.sql.SQLException, javax.naming.NamingException
sql
- The statement to compile.
java.sql.SQLException
- If an exception occurred in getting the statement.
javax.naming.NamingException
- If an error occurred in finding the DataSource in the JNDI tree.public java.sql.PreparedStatement prepareStatement(java.lang.String sql, int resultSetType, int resultSetConcurrency) throws java.sql.SQLException, javax.naming.NamingException
sql
- The SQL to compile.resultSetType
- Please see the Connection.prepareStatement() javadoc for more on this argument.resultSetConcurrency
- Please see the Connection.prepareStatement() javadoc for more on this argument.
java.sql.SQLException
- If an exception occurred in getting the statement.
javax.naming.NamingException
- If an error occurred in finding the DataSource in the JNDI tree.public java.sql.DatabaseMetaData getMetaData() throws javax.naming.NamingException, java.sql.SQLException
javax.naming.NamingException
- If an error occurred in finding the DataSource in the JNDI tree.
java.sql.SQLException
- If an exception occurred in getting the meta data.public void open() throws javax.naming.NamingException, java.sql.SQLException
javax.naming.NamingException
- If an error occurred in finding the DataSource in the JNDI tree.
java.sql.SQLException
- If an error occurred in opening the connection.public boolean runRetry()
runRetry
in class Retry
public static java.sql.Connection getConnection(java.util.Hashtable env, java.lang.String dataSourceName) throws javax.naming.NamingException, java.sql.SQLException
env
- The JNDI environment for the InitialContext. If this is
null it is assumed that new InitialContext() will work.dataSourceName
- The JNDI name of the DataSource.
javax.naming.NamingException
- If a error occurred in looking up the DataSource name.
java.sql.SQLException
- If an error occurred in getting the connection.public void close() throws java.sql.SQLException
java.sql.SQLException
- If an error occurred in opening the connection.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |