|
||||||||||
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
public class 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(Hashtable env,
String dataSourceName)
Creates new DataSourceWrapper |
Method Summary | |
---|---|
void |
close()
This closes the member's connection. |
Statement |
createStatement()
This method creates a statement from the DataSource. |
static Connection |
getConnection(Hashtable env,
String dataSourceName)
A static method for getting a JDBC connection from a DataSource. |
DatabaseMetaData |
getMetaData()
This method gets the connection's meta data. |
void |
open()
This method opens the connection. |
PreparedStatement |
prepareStatement(String sql)
This method creates a prepared statement. |
PreparedStatement |
prepareStatement(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(Hashtable env, String dataSourceName) throws SQLException, NamingException
env
- The JNDI env.dataSourceName
- The DataSource JNDI name.
SQLException
- If an error occurs during a database operation.
NamingException
- If there was a problem looking up the DataSource.Method Detail |
---|
public Statement createStatement() throws SQLException, NamingException
SQLException
- If an exception occurred in getting the statement.
NamingException
- If an exception occurred in opening the connection.public PreparedStatement prepareStatement(String sql) throws SQLException, NamingException
sql
- The statement to compile.
SQLException
- If an exception occurred in getting the statement.
NamingException
- If an error occurred in finding the DataSource in the JNDI tree.public PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency) throws SQLException, 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.
SQLException
- If an exception occurred in getting the statement.
NamingException
- If an error occurred in finding the DataSource in the JNDI tree.public DatabaseMetaData getMetaData() throws NamingException, SQLException
NamingException
- If an error occurred in finding the DataSource in the JNDI tree.
SQLException
- If an exception occurred in getting the meta data.public void open() throws NamingException, SQLException
NamingException
- If an error occurred in finding the DataSource in the JNDI tree.
SQLException
- If an error occurred in opening the connection.public boolean runRetry()
runRetry
in class Retry
public static Connection getConnection(Hashtable env, String dataSourceName) throws NamingException, 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.
NamingException
- If a error occurred in looking up the DataSource name.
SQLException
- If an error occurred in getting the connection.public void close() throws SQLException
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 |