|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.opensolaris.opengrok.jdbc.ConnectionResource
public class ConnectionResource
Class that manages the resources associated with a database connection.
This includes a cache of PreparedStatement
s.
Method Summary | |
---|---|
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 . |
java.sql.PreparedStatement |
prepareStatement(java.lang.String sql)
Prepare a statement. |
void |
rollback()
Abort the transaction. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public 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
necessary
PreparedStatement
object
java.sql.SQLException
- if a database error occurspublic java.sql.Statement createStatement() throws java.sql.SQLException
Statement
object.
Statement
object
java.sql.SQLException
public 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 compile
java.sql.SQLException
- if a database error occurspublic java.sql.DatabaseMetaData getMetaData() throws java.sql.SQLException
DatabaseMetaData
object
java.sql.SQLException
- if a database error occurs
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |