|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.quadrique.jbuildingblocks.core.database.JbbDatabaseClient
public class JbbDatabaseClient
This class encapsulates most of the JDBC api and provides a synchronous interface to any database.
| Method Summary | |
|---|---|
void |
acquireConnection(Context zContext,
String zJndiDataSourceName)
|
void |
acquireConnection(String zUrl,
String zLogin,
String zPassword,
String zDriver,
int zLoginTimeout)
This method initializes the corresponding driver and establishes a connection with the database. |
int[] |
executeBatch(ArrayList<String> zSqlRequests,
int zTimeOut)
Submits a batch of commands to the database for execution and if all commands execute successfully, returns an array of update counts. |
int |
executePreparedStatement(PreparedStatement zPreparedStatement,
int zTimeOut)
Executes a prepared statement which must be an SQL INSERT, UPDATE or DELETE statement; or an SQL statement that returns nothing, such as a DDL statement. |
ResultSet |
executePreparedStatementWithResultSet(PreparedStatement zPreparedStatement,
int zTimeOut)
Executes a prepared statement that returns a result set Please note that the call is executed in autocommit mode. |
int |
executeStatement(String zSqlRequest,
int zTimeOut)
Executes a SQL statement that does not return a result set (i.e. |
ResultSet |
executeStatementWithResultSet(String zSqlRequest,
int zTimeOut)
Executes an SQL statement that returns a single ResultSet object. |
int |
executeStoredProcedure(CallableStatement zStoredProcRequest,
int zTimeOut)
Executes a stored procedure that only returns an integer. |
ResultSet |
executeStoredProcedureWithResultSet(CallableStatement zStoredProcRequest,
int zTimeOut)
Executes a stored procedure that returns a single ResultSet object. |
CallableStatement |
getCallableStatement(String zCall,
int zMaxNbOfRecords)
This procedure creates and returns a callable statement instance so that the corresponding stored procedure input and output parameters (if any) can be set prior to performing a executeXxxxStoredProcedures() call. |
Connection |
getMConnection()
|
PreparedStatement |
getPreparedStatement(String zCall,
int zMaxNbOfRecords)
This procedure creates and returns a prepared statement instance (i.e. |
ResultSet |
getResultSet()
|
ResultSet |
getResultSet(int index)
|
static JbbDatabaseClient |
newInstance()
|
void |
releaseConnection()
Clean up the full intance. |
void |
releaseResultSetAndStatementOnly()
Clean up the result set and statement that were allocated. |
void |
setLog(String zLogFileName)
This method is used to turn on the traces of the driver manager and the drivers. |
void |
setResultSet(ResultSet rs)
|
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public static JbbDatabaseClient newInstance()
public void acquireConnection(String zUrl,
String zLogin,
String zPassword,
String zDriver,
int zLoginTimeout)
throws Exception
zUrl - the JDBC URL of the database,zLogin - the login to use for the database connection,zPassword - the password to use for the database connection,zDriver - the driver class to use (e.g. "sun.database.odbc.JdbcOdbcDriver"),zLoginTimeout - the maximum time in seconds that a driver will wait
while attempting to connect to a database.
Exception
public void acquireConnection(Context zContext,
String zJndiDataSourceName)
throws Exception
zContext - zJndiDataSourceName -
Exception
public void setLog(String zLogFileName)
throws Exception
zLogFileName - fully qualified name (e.g. "C\Temp\log.txt") of the file
that should be used by the driver manager and all the drivers for trace/log.
Exception
public int executeStatement(String zSqlRequest,
int zTimeOut)
throws Exception
zSqlRequest - the SQL statement to execute,zTimeOut - the timeout value to use for the request.
Exception
public int[] executeBatch(ArrayList<String> zSqlRequests,
int zTimeOut)
throws Exception
Exception
public ResultSet executeStatementWithResultSet(String zSqlRequest,
int zTimeOut)
throws Exception
zSqlRequest - the SQL SELECT statement to execute,zTimeOut - the timeout value to use for the request in seconds .
Exception
public int executeStoredProcedure(CallableStatement zStoredProcRequest,
int zTimeOut)
throws Exception
zStoredProcRequest - the callable statement corresponding to the
stored procedure to execute,zTimeOut - the timeout value to use for the request in seconds.
Exception
public ResultSet executeStoredProcedureWithResultSet(CallableStatement zStoredProcRequest,
int zTimeOut)
throws Exception
zStoredProcRequest - the callable statement correponding to the
stored procedure to execute,zTimeOut - the timeout value to use for the request in seconds.
Exception
public CallableStatement getCallableStatement(String zCall,
int zMaxNbOfRecords)
throws Exception
zCall - the following string:
zMaxNbOfRecords - the maximum number of records to return
Exception
public PreparedStatement getPreparedStatement(String zCall,
int zMaxNbOfRecords)
throws Exception
zCall - the SQL query with ? for each input parameterzMaxNbOfRecords - the maximum number of records to return
Exception
public int executePreparedStatement(PreparedStatement zPreparedStatement,
int zTimeOut)
throws Exception
PreparedStatement lStatement = lHandler.getPreparedStatement("update users_t set type=7 where user=toto",50);
lHandler.executePreparedStatement(lStatement,10);
zPreparedStatement - the prepared statementzTimeOut - the timeout value to use for the request in seconds.
Exception
public ResultSet executePreparedStatementWithResultSet(PreparedStatement zPreparedStatement,
int zTimeOut)
throws Exception
PreparedStatement lStatement = lHandler.getPreparedStatement("select * from users_t",50);
lRs = lHandler.executePreparedStatement(lStatement,10);
zPreparedStatement - the prepared statementzTimeOut - the timeout value to use for the request in seconds.
Exception
public void releaseResultSetAndStatementOnly()
throws Exception
Exception
public void releaseConnection()
throws Exception
Exception
public ResultSet getResultSet(int index)
throws Exception
index - the index of the ResultSet instance
Exceptionpublic ResultSet getResultSet()
public void setResultSet(ResultSet rs)
rs - public Connection getMConnection()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||