|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.holub.database.jdbc.adapters.ConnectionAdapter
com.holub.database.jdbc.JDBCConnection
public class JDBCConnection
A limited version of the Connection class. All methods
undocumented base-class overrides throw a
SQLException
if called.
Note that you can't
mix non-autocommit behavior with explicit
SQL begin/commit statements. For example, if you
turn off autocommit mode (which causes a SQL begin
to be issued), and then execute a SQL begin manually,
a call to `commit` will commit the inner transaction,
but not the outer one. In effect, you can't do
nested transactions using the JDBC commit()
or
rollback()
methods.
This code may be used freely by yourself with the following restrictions:
|
Field Summary |
---|
Fields inherited from interface java.sql.Connection |
---|
TRANSACTION_NONE, TRANSACTION_READ_COMMITTED, TRANSACTION_READ_UNCOMMITTED, TRANSACTION_REPEATABLE_READ, TRANSACTION_SERIALIZABLE |
Constructor Summary | |
---|---|
JDBCConnection(String uri)
|
|
JDBCConnection(URI uri)
|
Method Summary | |
---|---|
void |
close()
Close a database connection. |
void |
commit()
Terminate the current transactions and start a new one. |
Statement |
createStatement()
|
boolean |
getAutoCommit()
Return true if auto-commit mode is enabled |
void |
rollback()
Roll back the current transactions and start a new one. |
void |
setAutoCommit(boolean enable)
Once set true, all SQL statements form a stand-alone transaction. |
Methods inherited from class com.holub.database.jdbc.adapters.ConnectionAdapter |
---|
clearWarnings, createStatement, createStatement, getCatalog, getHoldability, getMetaData, getTransactionIsolation, getTypeMap, getWarnings, isClosed, isReadOnly, nativeSQL, prepareCall, prepareCall, prepareCall, prepareStatement, prepareStatement, prepareStatement, prepareStatement, prepareStatement, prepareStatement, releaseSavepoint, rollback, setCatalog, setHoldability, setReadOnly, setSavepoint, setSavepoint, setTransactionIsolation, setTypeMap |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public JDBCConnection(String uri) throws SQLException, URISyntaxException, IOException
SQLException
URISyntaxException
IOException
public JDBCConnection(URI uri) throws SQLException, IOException
SQLException
IOException
Method Detail |
---|
public void close() throws SQLException
close
in interface Connection
close
in class ConnectionAdapter
SQLException
setAutoCommit(boolean)
public Statement createStatement() throws SQLException
createStatement
in interface Connection
createStatement
in class ConnectionAdapter
SQLException
public void commit() throws SQLException
commit
in interface Connection
commit
in class ConnectionAdapter
SQLException
setAutoCommit(boolean)
public void rollback() throws SQLException
rollback
in interface Connection
rollback
in class ConnectionAdapter
SQLException
setAutoCommit(boolean)
public void setAutoCommit(boolean enable) throws SQLException
commit()
and rollback()
methods will work correctly.
Similarly, a commit is issued automatically when
auto-commit mode is enabled.
Auto-commit mode is on by default.
setAutoCommit
in interface Connection
setAutoCommit
in class ConnectionAdapter
SQLException
public boolean getAutoCommit() throws SQLException
getAutoCommit
in interface Connection
getAutoCommit
in class ConnectionAdapter
SQLException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |