public class DBPoolConnection
extends java.lang.Object
implements java.sql.Connection
| Constructor and Description |
|---|
DBPoolConnection(DBConnectionPool cp,
java.sql.Connection dbConn) |
| Modifier and Type | Method and Description |
|---|---|
void |
abort(java.util.concurrent.Executor executor) |
void |
begin()
Starts a transaction on this connection.
|
void |
begin(int txIsolationLevel)
Same as begin() but sets the isolation level to TRANSACTION_REPEATABLE_READ.
|
void |
clearWarnings() |
void |
close()
Releases the connection and returns it to the pool as a free connection.
|
void |
commit()
Commits a transaction on this connection.
|
java.sql.Array |
createArrayOf(java.lang.String typeName,
java.lang.Object[] elements) |
java.sql.Blob |
createBlob() |
java.sql.Clob |
createClob() |
java.sql.NClob |
createNClob() |
java.sql.SQLXML |
createSQLXML() |
java.sql.Statement |
createStatement()
Delegates to java.sql.Connection.createStatement()
|
java.sql.Statement |
createStatement(int resultSetType,
int resultSetConcurrency)
Delegates to java.sql.Connection.createStatement(int, int)
|
java.sql.Statement |
createStatement(int resultSetType,
int resultSetConcurrency,
int resultSetHoldability)
Delegates to java.sql.Connection.createStatement(int, int, int)
|
java.sql.Struct |
createStruct(java.lang.String typeName,
java.lang.Object[] attributes) |
void |
disconnect()
Closes the underlying JDBC connection and leaves this object unusable.
|
int |
getAccessCount()
Tells how often this connection has been taken from the pool
|
boolean |
getAutoCommit() |
java.lang.String |
getCatalog() |
java.util.Properties |
getClientInfo() |
java.lang.String |
getClientInfo(java.lang.String name) |
java.sql.Connection |
getConnection()
Returns the underlying JDBC Connection object.
|
DBConnectionPool |
getConnectionPool() |
int |
getHoldability()
Delegates to java.sql.Connection.getHoldability()
|
int |
getId()
Returns the unique Connection ID.
|
long |
getLastUsedTime()
Tells how long this connection has been used for the last action
|
java.sql.DatabaseMetaData |
getMetaData() |
int |
getNetworkTimeout() |
java.lang.String |
getSchema() |
long |
getTotalUsedTime()
Tells how long this connection has been used in total
|
int |
getTransactionIsolation() |
int |
getTransactionLevel() |
java.util.Map<java.lang.String,java.lang.Class<?>> |
getTypeMap() |
java.sql.SQLWarning |
getWarnings() |
boolean |
isClosed()
Tells whether this connection has been closed.
|
boolean |
isReadOnly() |
boolean |
isValid(int timeout) |
boolean |
isWrapperFor(java.lang.Class<?> iface) |
java.lang.String |
nativeSQL(java.lang.String sql) |
java.sql.CallableStatement |
prepareCall(java.lang.String sql)
Delegates to java.sql.Connection.prepareCall(java.lang.String)
|
java.sql.CallableStatement |
prepareCall(java.lang.String sql,
int resultSetType,
int resultSetConcurrency)
Delegates to java.sql.Connection.prepareCall(java.lang.String, int, int)
|
java.sql.CallableStatement |
prepareCall(java.lang.String sql,
int resultSetType,
int resultSetConcurrency,
int resultSetHoldability)
Delegates to java.sql.Connection.prepareCall(java.lang.String, int, int, int)
|
java.sql.PreparedStatement |
prepareStatement(java.lang.String sql)
Delegates to java.sql.Connection.prepareStatement(java.lang.String)
|
java.sql.PreparedStatement |
prepareStatement(java.lang.String sql,
int autoGeneratedKeys)
Delegates to java.sql.Connection.prepareStatement(java.lang.String, int)
|
java.sql.PreparedStatement |
prepareStatement(java.lang.String sql,
int[] columnIndexes)
Delegates to java.sql.Connection.prepareStatement(java.lang.String, int)
|
java.sql.PreparedStatement |
prepareStatement(java.lang.String sql,
int resultSetType,
int resultSetConcurrency)
Delegates to java.sql.Connection.prepareStatement(java.lang.String, int, int)
|
java.sql.PreparedStatement |
prepareStatement(java.lang.String sql,
int resultSetType,
int resultSetConcurrency,
int resultSetHoldability)
Delegates to java.sql.Connection.prepareStatement(java.lang.String, int, int, int)
|
java.sql.PreparedStatement |
prepareStatement(java.lang.String sql,
java.lang.String[] columnNames)
Delegates to java.sql.Connection.prepareStatement(java.lang.String, java.lang.String)
|
void |
releaseSavepoint(java.sql.Savepoint savepoint)
Delegates to java.sql.Connection.releaseSavepoint(Savepoint)
|
void |
rollback()
The current transaction on this connection is stopped and rolled back.
|
void |
rollback(java.sql.Savepoint savepoint)
Delegates to java.sql.Connection.rollback(Savepoint)
|
void |
setAutoCommit(boolean autoCommit) |
void |
setCatalog(java.lang.String catalog) |
void |
setClientInfo(java.util.Properties properties) |
void |
setClientInfo(java.lang.String name,
java.lang.String value) |
void |
setHoldability(int holdability)
Delegates to java.sql.Connection.setHoldability(int)
|
void |
setNetworkTimeout(java.util.concurrent.Executor executor,
int milliseconds) |
void |
setReadOnly(boolean readOnly) |
java.sql.Savepoint |
setSavepoint()
Delegates to java.sql.Connection.setSavepoint()
|
java.sql.Savepoint |
setSavepoint(java.lang.String name)
Delegates to java.sql.Connection.setSavepoint(java.lang.String)
|
void |
setSchema(java.lang.String schema) |
void |
setTransactionIsolation(int level) |
void |
setTypeMap(java.util.Map<java.lang.String,java.lang.Class<?>> map) |
void |
startUse()
Starts measuring the use-time for this connection and increments the access count.
|
void |
stopUse()
Stops measuring the use-time for this connection.
|
java.lang.String |
toString() |
<T> T |
unwrap(java.lang.Class<T> iface) |
public DBPoolConnection(DBConnectionPool cp, java.sql.Connection dbConn)
public DBConnectionPool getConnectionPool()
public int getId()
public int getTransactionLevel()
public int getAccessCount()
public java.sql.Connection getConnection()
public void startUse()
stopUse()public void stopUse()
startUse()public long getLastUsedTime()
public long getTotalUsedTime()
public void disconnect()
public void close()
close in interface java.lang.AutoCloseableclose in interface java.sql.Connectionpublic boolean isClosed()
isClosed in interface java.sql.Connectionpublic void begin()
throws java.sql.SQLException
Note that this call MUST be followed by a commit() or rollback() call in order to free the connection after usage. Otherwise this connection will be blocked forever.
Note further that nesting of transactions is supported. Thus it is permitted for a thread to call begin() n times. If done so you must also call commit() n times until the real COMMIT is done in the database. Any rollback() call however will break the transaction no matter of it's nesting level.
java.sql.SQLExceptioncommit(),
rollback()public void begin(int txIsolationLevel)
throws java.sql.SQLException
java.sql.SQLExceptionpublic void commit()
throws java.sql.SQLException
commit in interface java.sql.Connectionjava.sql.SQLExceptionbegin()public void rollback()
rollback in interface java.sql.Connectionbegin()public java.sql.Statement createStatement()
throws java.sql.SQLException
createStatement in interface java.sql.Connectionjava.sql.SQLExceptionpublic java.sql.PreparedStatement prepareStatement(java.lang.String sql)
throws java.sql.SQLException
prepareStatement in interface java.sql.Connectionjava.sql.SQLExceptionpublic java.sql.CallableStatement prepareCall(java.lang.String sql)
throws java.sql.SQLException
prepareCall in interface java.sql.Connectionjava.sql.SQLExceptionpublic java.lang.String nativeSQL(java.lang.String sql)
throws java.sql.SQLException
nativeSQL in interface java.sql.Connectionjava.sql.SQLExceptionConnection.nativeSQL(java.lang.String)public void setAutoCommit(boolean autoCommit)
throws java.sql.SQLException
setAutoCommit in interface java.sql.Connectionjava.sql.SQLExceptionConnection.setAutoCommit(boolean)public boolean getAutoCommit()
throws java.sql.SQLException
getAutoCommit in interface java.sql.Connectionjava.sql.SQLExceptionConnection.getAutoCommit()public java.sql.DatabaseMetaData getMetaData()
throws java.sql.SQLException
getMetaData in interface java.sql.Connectionjava.sql.SQLExceptionConnection.getMetaData()public void setReadOnly(boolean readOnly)
throws java.sql.SQLException
setReadOnly in interface java.sql.Connectionjava.sql.SQLExceptionConnection.setReadOnly(boolean)public boolean isReadOnly()
throws java.sql.SQLException
isReadOnly in interface java.sql.Connectionjava.sql.SQLExceptionConnection.isReadOnly()public void setCatalog(java.lang.String catalog)
throws java.sql.SQLException
setCatalog in interface java.sql.Connectionjava.sql.SQLExceptionConnection.setCatalog(java.lang.String)public java.lang.String getCatalog()
throws java.sql.SQLException
getCatalog in interface java.sql.Connectionjava.sql.SQLExceptionConnection.getCatalog()public void setTransactionIsolation(int level)
throws java.sql.SQLException
setTransactionIsolation in interface java.sql.Connectionjava.sql.SQLExceptionConnection.setTransactionIsolation(int)public int getTransactionIsolation()
throws java.sql.SQLException
getTransactionIsolation in interface java.sql.Connectionjava.sql.SQLExceptionConnection.getTransactionIsolation()public java.sql.SQLWarning getWarnings()
throws java.sql.SQLException
getWarnings in interface java.sql.Connectionjava.sql.SQLExceptionConnection.getWarnings()public void clearWarnings()
throws java.sql.SQLException
clearWarnings in interface java.sql.Connectionjava.sql.SQLExceptionConnection.clearWarnings()public java.sql.Statement createStatement(int resultSetType,
int resultSetConcurrency)
throws java.sql.SQLException
createStatement in interface java.sql.Connectionjava.sql.SQLExceptionpublic java.sql.PreparedStatement prepareStatement(java.lang.String sql,
int resultSetType,
int resultSetConcurrency)
throws java.sql.SQLException
prepareStatement in interface java.sql.Connectionjava.sql.SQLExceptionpublic java.sql.CallableStatement prepareCall(java.lang.String sql,
int resultSetType,
int resultSetConcurrency)
throws java.sql.SQLException
prepareCall in interface java.sql.Connectionjava.sql.SQLExceptionpublic java.util.Map<java.lang.String,java.lang.Class<?>> getTypeMap()
throws java.sql.SQLException
getTypeMap in interface java.sql.Connectionjava.sql.SQLExceptionConnection.getTypeMap()public void setHoldability(int holdability)
throws java.sql.SQLException
setHoldability in interface java.sql.Connectionjava.sql.SQLExceptionpublic int getHoldability()
throws java.sql.SQLException
getHoldability in interface java.sql.Connectionjava.sql.SQLExceptionpublic java.sql.Savepoint setSavepoint()
throws java.sql.SQLException
setSavepoint in interface java.sql.Connectionjava.sql.SQLExceptionpublic java.sql.Savepoint setSavepoint(java.lang.String name)
throws java.sql.SQLException
setSavepoint in interface java.sql.Connectionjava.sql.SQLExceptionpublic void rollback(java.sql.Savepoint savepoint)
throws java.sql.SQLException
rollback in interface java.sql.Connectionjava.sql.SQLExceptionpublic void releaseSavepoint(java.sql.Savepoint savepoint)
throws java.sql.SQLException
releaseSavepoint in interface java.sql.Connectionjava.sql.SQLExceptionpublic java.sql.Statement createStatement(int resultSetType,
int resultSetConcurrency,
int resultSetHoldability)
throws java.sql.SQLException
createStatement in interface java.sql.Connectionjava.sql.SQLExceptionpublic java.sql.PreparedStatement prepareStatement(java.lang.String sql,
int resultSetType,
int resultSetConcurrency,
int resultSetHoldability)
throws java.sql.SQLException
prepareStatement in interface java.sql.Connectionjava.sql.SQLExceptionpublic java.sql.CallableStatement prepareCall(java.lang.String sql,
int resultSetType,
int resultSetConcurrency,
int resultSetHoldability)
throws java.sql.SQLException
prepareCall in interface java.sql.Connectionjava.sql.SQLExceptionpublic java.sql.PreparedStatement prepareStatement(java.lang.String sql,
int autoGeneratedKeys)
throws java.sql.SQLException
prepareStatement in interface java.sql.Connectionjava.sql.SQLExceptionpublic java.sql.PreparedStatement prepareStatement(java.lang.String sql,
int[] columnIndexes)
throws java.sql.SQLException
prepareStatement in interface java.sql.Connectionjava.sql.SQLExceptionpublic java.sql.PreparedStatement prepareStatement(java.lang.String sql,
java.lang.String[] columnNames)
throws java.sql.SQLException
prepareStatement in interface java.sql.Connectionjava.sql.SQLExceptionpublic java.sql.Array createArrayOf(java.lang.String typeName,
java.lang.Object[] elements)
throws java.sql.SQLException
createArrayOf in interface java.sql.Connectionjava.sql.SQLExceptionpublic java.sql.Blob createBlob()
throws java.sql.SQLException
createBlob in interface java.sql.Connectionjava.sql.SQLExceptionpublic java.sql.Clob createClob()
throws java.sql.SQLException
createClob in interface java.sql.Connectionjava.sql.SQLExceptionpublic java.sql.NClob createNClob()
throws java.sql.SQLException
createNClob in interface java.sql.Connectionjava.sql.SQLExceptionpublic java.sql.SQLXML createSQLXML()
throws java.sql.SQLException
createSQLXML in interface java.sql.Connectionjava.sql.SQLExceptionpublic java.sql.Struct createStruct(java.lang.String typeName,
java.lang.Object[] attributes)
throws java.sql.SQLException
createStruct in interface java.sql.Connectionjava.sql.SQLExceptionpublic java.util.Properties getClientInfo()
throws java.sql.SQLException
getClientInfo in interface java.sql.Connectionjava.sql.SQLExceptionpublic java.lang.String getClientInfo(java.lang.String name)
throws java.sql.SQLException
getClientInfo in interface java.sql.Connectionjava.sql.SQLExceptionpublic boolean isValid(int timeout)
throws java.sql.SQLException
isValid in interface java.sql.Connectionjava.sql.SQLExceptionpublic void setClientInfo(java.util.Properties properties)
throws java.sql.SQLClientInfoException
setClientInfo in interface java.sql.Connectionjava.sql.SQLClientInfoExceptionpublic void setClientInfo(java.lang.String name,
java.lang.String value)
throws java.sql.SQLClientInfoException
setClientInfo in interface java.sql.Connectionjava.sql.SQLClientInfoExceptionpublic void setTypeMap(java.util.Map<java.lang.String,java.lang.Class<?>> map)
throws java.sql.SQLException
setTypeMap in interface java.sql.Connectionjava.sql.SQLExceptionpublic boolean isWrapperFor(java.lang.Class<?> iface)
throws java.sql.SQLException
isWrapperFor in interface java.sql.Wrapperjava.sql.SQLExceptionpublic <T> T unwrap(java.lang.Class<T> iface)
throws java.sql.SQLException
unwrap in interface java.sql.Wrapperjava.sql.SQLExceptionpublic void setSchema(java.lang.String schema)
throws java.sql.SQLException
setSchema in interface java.sql.Connectionjava.sql.SQLExceptionpublic java.lang.String getSchema()
throws java.sql.SQLException
getSchema in interface java.sql.Connectionjava.sql.SQLExceptionpublic void abort(java.util.concurrent.Executor executor)
throws java.sql.SQLException
abort in interface java.sql.Connectionjava.sql.SQLExceptionpublic void setNetworkTimeout(java.util.concurrent.Executor executor,
int milliseconds)
throws java.sql.SQLException
setNetworkTimeout in interface java.sql.Connectionjava.sql.SQLExceptionpublic int getNetworkTimeout()
throws java.sql.SQLException
getNetworkTimeout in interface java.sql.Connectionjava.sql.SQLExceptionpublic java.lang.String toString()
toString in class java.lang.ObjectCopyright © 2014 EsprIT-Systems. All Rights Reserved.