public class ConnectionResource
extends java.lang.Object
PreparedStatements.| Modifier and Type | Method and Description |
|---|---|
void |
commit()
Commit the transaction.
|
java.sql.Statement |
createStatement()
Create a new
Statement object. |
java.sql.DatabaseMetaData |
getMetaData()
Get a meta-data object for the underlying connection.
|
java.sql.PreparedStatement |
getStatement(StatementCreator creator)
Get a
PreparedStatement as defined by the specified
StatementCreator. |
boolean |
isValid()
Check if the connection is still valid.
|
java.sql.PreparedStatement |
prepareStatement(java.lang.String sql)
Prepare a statement.
|
void |
rollback()
Abort the transaction.
|
public boolean isValid()
throws java.sql.SQLException
true if the connection is valid, false if notjava.sql.SQLException - if a database error occurspublic void commit()
throws java.sql.SQLException
java.sql.SQLException - if a database error occurspublic void rollback()
throws java.sql.SQLException
java.sql.SQLException - if a database error occurspublic java.sql.PreparedStatement getStatement(StatementCreator creator) throws java.sql.SQLException
PreparedStatement as defined by the specified
StatementCreator. If it is the first time the statement
creator is used on this ConnectionResource, the creator's
StatementCreator.create(Connection) method is called to
create a new PreparedStatement. This statement is cached,
so that on subsequent calls with the same statement creator, the same
PreparedStatement will be returned.creator - object that specifies how to create the statement if
necessaryPreparedStatement objectjava.sql.SQLException - if a database error occurspublic java.sql.Statement createStatement()
throws java.sql.SQLException
Statement object.Statement objectjava.sql.SQLExceptionpublic java.sql.PreparedStatement prepareStatement(java.lang.String sql)
throws java.sql.SQLException
StatementCreator object should be
created for it, and the method getStatement(StatementCreator)
should be used instead.sql - the SQL text to compilejava.sql.SQLException - if a database error occurspublic java.sql.DatabaseMetaData getMetaData()
throws java.sql.SQLException
DatabaseMetaData objectjava.sql.SQLException - if a database error occurs