|
Enhydra 3.1 API | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.lutris.appserver.server.sql.standard.StandardDBConnection
Standard implementation of the DBConnection object.
DBConnection
Field Summary | |
protected java.sql.Connection |
connection
JDBC connection object. |
protected ConnectionAllocator |
connectionAllocator
|
protected java.lang.String |
password
Database user password. |
protected java.lang.String |
url
Database URL, used for error messages. |
protected java.lang.String |
user
Database user, for error messages. |
Constructor Summary | |
protected |
StandardDBConnection(ConnectionAllocator connectionAllocatorObj,
java.lang.String url,
java.lang.String user,
java.lang.String password,
int maxPreparedStatements,
boolean logging,
int generation)
Initialize the connection to a database. |
Method Summary | |
void |
allocate()
Method called when this connection object is allocated from the connection allocator. |
void |
close()
Close this connection. |
void |
commit()
Commit a transaction. |
boolean |
execute(java.lang.String sql)
Execute a SQL statement that does not return a resultset. |
java.sql.ResultSet |
executeQuery(java.sql.PreparedStatement preparedStmt,
java.lang.String msg)
Execute a prepared query statement. |
java.sql.ResultSet |
executeQuery(java.lang.String sql)
Execute a SQL query statement. |
int |
executeUpdate(java.sql.PreparedStatement preparedStmt,
java.lang.String msg)
Execute a prepared update statement. |
int |
executeUpdate(java.lang.String sql)
Execute a SQL update statement. |
java.sql.Connection |
getConnection()
Get the underlying Connection object. |
int |
getGeneration()
Get the generation number specified when the connection was created. |
java.lang.String |
getUrl()
Get the database URL. |
java.lang.String |
getUser()
Get the database user name. |
boolean |
handleException(java.sql.SQLException sqlExcept)
Check if a connection is valid after an SQL exception is thrown. |
void |
incrRequestCount()
Increment the count of the number of requests against this connection. |
protected void |
logDebug(java.lang.String str)
Debug logging. |
protected void |
logDebug(java.lang.String str,
java.sql.Statement stmt)
Debug logging. |
java.sql.CallableStatement |
prepareCall(java.lang.String sql)
Creates a CallableStatement object for calling database stored procedures. |
java.sql.PreparedStatement |
prepareStatement(java.lang.String sql)
Get a prepared statement given an SQL string. |
void |
release()
Return this connection to its allocator. |
void |
reset()
Closes down all query-specific resources. |
void |
rollback()
Rollback a transaction. |
void |
setAutoCommit(boolean on)
Autocommit on/off. |
void |
validate()
Validates this connection. |
void |
warningCheck(java.sql.ResultSet resultSet)
Check for warnings in a result set. |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Field Detail |
protected java.sql.Connection connection
protected java.lang.String url
protected java.lang.String user
protected java.lang.String password
protected ConnectionAllocator connectionAllocator
Constructor Detail |
protected StandardDBConnection(ConnectionAllocator connectionAllocatorObj, java.lang.String url, java.lang.String user, java.lang.String password, int maxPreparedStatements, boolean logging, int generation) throws java.sql.SQLException
url
- JDBC URL of database.user
- SQL user name.password
- SQL password.connectionAllocatorObj
- The connection allocator that this
connection belongs to.maxPreparedStatements
- Maximum number of preparse statements.
a value of less than zero queries JDBC for the value.logging
- Specifying true
enables SQL logging.generation
- A generation number used to drop old connection
when they are released.Method Detail |
public void allocate() throws java.sql.SQLException
reset
had no
been called on the previous operation.public void validate() throws java.sql.SQLException
public void reset() throws java.sql.SQLException
public java.sql.PreparedStatement prepareStatement(java.lang.String sql) throws java.sql.SQLException
sql
- The SQL statement to prepared.public java.sql.CallableStatement prepareCall(java.lang.String sql) throws java.sql.SQLException
sql
- The SQL statement to be called.public java.sql.ResultSet executeQuery(java.sql.PreparedStatement preparedStmt, java.lang.String msg) throws java.sql.SQLException
reset()
should be called.preparedStmt
- The statement to execute.msg
- for logging/debug purposespublic java.sql.ResultSet executeQuery(java.lang.String sql) throws java.sql.SQLException
reset()
should be called.sql
- The SQL query statementpublic int executeUpdate(java.lang.String sql) throws java.sql.SQLException
reset()
should be called.sql
- The SQL query statementpublic int executeUpdate(java.sql.PreparedStatement preparedStmt, java.lang.String msg) throws java.sql.SQLException
reset()
should be called.preparedStmt
- The statement to execute.msg
- for logging/debug purposespublic boolean execute(java.lang.String sql) throws java.sql.SQLException
reset()
should be called.sql
- The SQL query statementpublic void warningCheck(java.sql.ResultSet resultSet) throws java.sql.SQLException
resultSet
- The result set to check for warnings.public void release()
public boolean handleException(java.sql.SQLException sqlExcept)
sqlExcept
- The SQL exception that occured.public int getGeneration()
public void close()
public void setAutoCommit(boolean on) throws java.sql.SQLException
on
- - False to disable auto commit mode. True to enable.public void commit() throws java.sql.SQLException
public void rollback() throws java.sql.SQLException
protected void logDebug(java.lang.String str)
str
- The data to log.protected void logDebug(java.lang.String str, java.sql.Statement stmt)
str
- The data to log.stmt
- The statement to log.public void incrRequestCount()
public java.lang.String getUrl()
public java.lang.String getUser()
public java.sql.Connection getConnection()
Connection
object.
Use with extreme caution.
|
Enhydra 3.1 API | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |