|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.cometway.jdbc.JDBCConnection
public class JDBCConnection
This class implements a pool-able JDBCConnection.
| Field Summary | |
|---|---|
protected static int |
DEFAULT_MAX_ROW_SIZE
|
protected ReporterInterface |
reporter
|
protected static int |
uniqueIndex
|
| Fields inherited from interface java.sql.Connection |
|---|
TRANSACTION_NONE, TRANSACTION_READ_COMMITTED, TRANSACTION_READ_UNCOMMITTED, TRANSACTION_REPEATABLE_READ, TRANSACTION_SERIALIZABLE |
| Constructor Summary | |
|---|---|
JDBCConnection(java.lang.String jdbcURL,
java.sql.Connection connection,
JDBCConnectionPool ownerPool,
ReporterInterface reporter)
Users will probably not need to call the constructor directly; the connection is typically created by a ConnectionPoolManager. |
|
JDBCConnection(java.lang.String jdbcDriver,
java.lang.String jdbcURL,
java.lang.String username,
java.lang.String password)
|
|
| Method Summary | |
|---|---|
void |
buildDataTypeInfo()
Builds a type information list specific to this driver connection. |
void |
clearWarnings()
|
void |
close()
It is really important to call close when you are done using a pooled JDBCConnection because un-closed connections will be unusable until the ConnectionReaper gets around to freeing them. |
void |
commit()
|
java.sql.Statement |
createStatement()
|
java.sql.Statement |
createStatement(int parm1,
int parm2)
|
java.sql.Statement |
createStatement(int parm1,
int parm2,
int parm3)
|
void |
debug(java.lang.String message)
Prints a debug message tagged with this Connection's identity to the output stream. |
void |
error(java.lang.String message)
Prints an error message tagged with this Connection's identity to the error stream. |
void |
error(java.lang.String message,
java.lang.Exception e)
Prints an error message tagged with this Connection's identity followed by a stack trace of the passed Exception to the error stream. |
java.lang.String |
executeQuery(java.lang.String sql)
Executes the query contained in the argument, returning results as a String. |
java.lang.String |
executeUpdate(java.lang.String sql)
Executes the update contained in the argument, returning results as a String. |
protected void |
expireLease()
Called by the ConnectionReaper to forcibly expire this lease. |
boolean |
getAutoCommit()
|
java.lang.String |
getCatalog()
|
java.sql.Connection |
getConnection()
Returns the actual java.sql.Connection object used by this JDBCConnection. |
java.sql.Driver |
getDriver()
Returns the String used to load the JDBC driver. |
int |
getHoldability()
|
long |
getLastUse()
Returns a long containing the timestamp when this connection was leased. |
int |
getMaxRowSize()
Should return the maximum row size supported by the current database but JDBC drivers have problems reporting MAX_ROW_SIZE accurately so MAX_ROW_SIZE is hard-coded to be 255. |
java.sql.DatabaseMetaData |
getMetaData()
|
java.lang.String |
getStatus()
Returns the current status information and performance data for this connection. |
int |
getTransactionIsolation()
|
java.util.Map |
getTypeMap()
|
java.lang.String |
getTypeName(int dataType)
Get the String name for the DataType with this ID. |
java.sql.SQLWarning |
getWarnings()
|
boolean |
inUse()
Returns true if the JDBCConnection is currently in use; false otherwise. |
boolean |
isClosed()
|
boolean |
isReadOnly()
|
boolean |
lease()
Called by the JDBCConnectionPool. |
java.lang.String |
nativeSQL(java.lang.String sql)
|
java.sql.CallableStatement |
prepareCall(java.lang.String sql)
|
java.sql.CallableStatement |
prepareCall(java.lang.String sql,
int parm2,
int parm3)
|
java.sql.CallableStatement |
prepareCall(java.lang.String sql,
int parm2,
int parm3,
int parm4)
|
java.sql.PreparedStatement |
prepareStatement(java.lang.String sql)
|
java.sql.PreparedStatement |
prepareStatement(java.lang.String sql,
int parm2)
|
java.sql.PreparedStatement |
prepareStatement(java.lang.String sql,
int[] parm2)
|
java.sql.PreparedStatement |
prepareStatement(java.lang.String sql,
int parm2,
int parm3)
|
java.sql.PreparedStatement |
prepareStatement(java.lang.String sql,
int parm2,
int parm3,
int parm4)
|
java.sql.PreparedStatement |
prepareStatement(java.lang.String sql,
java.lang.String[] parm2)
|
void |
println(java.lang.String message)
Prints a message tagged with this connection's identity to the output stream. |
void |
releaseSavepoint(java.sql.Savepoint savepnt)
|
void |
rollback()
|
void |
rollback(java.sql.Savepoint sp)
|
void |
setAutoCommit(boolean autoCommit)
|
void |
setCatalog(java.lang.String catalog)
|
protected void |
setConnection(java.sql.Connection connection)
Sets the JDBC Connection and initializes the database MetaData used by this class. |
void |
setHoldability(int parm1)
|
void |
setReadOnly(boolean readOnly)
|
void |
setReporter(ReporterInterface reporter)
Sets the reporter for this Connection. |
java.sql.Savepoint |
setSavepoint()
|
java.sql.Savepoint |
setSavepoint(java.lang.String savepnt)
|
void |
setTransactionIsolation(int level)
|
void |
setTypeMap(java.util.Map map)
|
java.lang.String |
toString()
Returns this connection as a String. |
boolean |
validate()
Called by the ConnectionReaper to determine if this connection should be freed. |
void |
warning(java.lang.String message)
Prints a warning message tagged with this Connection's identity to the error stream. |
void |
warning(java.lang.String message,
java.lang.Exception e)
Prints an warning message tagged with this Connection's identity followed by a stack trace of the passed Exception to error stream. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected static int uniqueIndex
protected static final int DEFAULT_MAX_ROW_SIZE
protected ReporterInterface reporter
| Constructor Detail |
|---|
public JDBCConnection(java.lang.String jdbcURL,
java.sql.Connection connection,
JDBCConnectionPool ownerPool,
ReporterInterface reporter)
con - The JDBC Connection to useownerPool - The ThreadPool to use when performing
lazy database modifications
public JDBCConnection(java.lang.String jdbcDriver,
java.lang.String jdbcURL,
java.lang.String username,
java.lang.String password)
jdbcDriver - The JDBC Driver to usejdbcURL - The JDBC URL to useusername - The username to use for DB accesspassword - The password to use for DB access| Method Detail |
|---|
public boolean lease()
public boolean validate()
public boolean inUse()
public long getLastUse()
public void close()
throws java.sql.SQLException
close in interface java.sql.Connectionjava.sql.SQLException - if there was a problem closing the connectionprotected void expireLease()
public int getMaxRowSize()
public void buildDataTypeInfo()
public java.lang.String executeQuery(java.lang.String sql)
sql - The query to execute.public java.lang.String executeUpdate(java.lang.String sql)
sql - The update to execute.public java.sql.Connection getConnection()
public java.sql.Driver getDriver()
public java.lang.String getStatus()
public java.lang.String getTypeName(int dataType)
dataType - protected void setConnection(java.sql.Connection connection)
public void debug(java.lang.String message)
public void warning(java.lang.String message)
public void warning(java.lang.String message,
java.lang.Exception e)
public void error(java.lang.String message)
public void error(java.lang.String message,
java.lang.Exception e)
public void println(java.lang.String message)
public void setReporter(ReporterInterface reporter)
public java.lang.String toString()
toString in class java.lang.Object
public java.sql.PreparedStatement prepareStatement(java.lang.String sql)
throws java.sql.SQLException
prepareStatement in interface java.sql.Connectionjava.sql.SQLException
public java.sql.PreparedStatement prepareStatement(java.lang.String sql,
int parm2,
int parm3)
throws java.sql.SQLException
prepareStatement in interface java.sql.Connectionjava.sql.SQLException
public java.sql.CallableStatement prepareCall(java.lang.String sql)
throws java.sql.SQLException
prepareCall in interface java.sql.Connectionjava.sql.SQLException
public java.sql.CallableStatement prepareCall(java.lang.String sql,
int parm2,
int parm3)
throws java.sql.SQLException
prepareCall in interface java.sql.Connectionjava.sql.SQLException
public java.sql.Statement createStatement()
throws java.sql.SQLException
createStatement in interface java.sql.Connectionjava.sql.SQLException
public java.sql.Statement createStatement(int parm1,
int parm2)
throws java.sql.SQLException
createStatement in interface java.sql.Connectionjava.sql.SQLException
public java.lang.String nativeSQL(java.lang.String sql)
throws java.sql.SQLException
nativeSQL in interface java.sql.Connectionjava.sql.SQLException
public java.util.Map getTypeMap()
throws java.sql.SQLException
getTypeMap in interface java.sql.Connectionjava.sql.SQLException
public void setTypeMap(java.util.Map map)
throws java.sql.SQLException
setTypeMap in interface java.sql.Connectionjava.sql.SQLException
public void setAutoCommit(boolean autoCommit)
throws java.sql.SQLException
setAutoCommit in interface java.sql.Connectionjava.sql.SQLException
public boolean getAutoCommit()
throws java.sql.SQLException
getAutoCommit in interface java.sql.Connectionjava.sql.SQLException
public void commit()
throws java.sql.SQLException
commit in interface java.sql.Connectionjava.sql.SQLException
public void rollback()
throws java.sql.SQLException
rollback in interface java.sql.Connectionjava.sql.SQLException
public boolean isClosed()
throws java.sql.SQLException
isClosed in interface java.sql.Connectionjava.sql.SQLException
public java.sql.DatabaseMetaData getMetaData()
throws java.sql.SQLException
getMetaData in interface java.sql.Connectionjava.sql.SQLException
public void setReadOnly(boolean readOnly)
throws java.sql.SQLException
setReadOnly in interface java.sql.Connectionjava.sql.SQLException
public boolean isReadOnly()
throws java.sql.SQLException
isReadOnly in interface java.sql.Connectionjava.sql.SQLException
public void setCatalog(java.lang.String catalog)
throws java.sql.SQLException
setCatalog in interface java.sql.Connectionjava.sql.SQLException
public java.lang.String getCatalog()
throws java.sql.SQLException
getCatalog in interface java.sql.Connectionjava.sql.SQLException
public void setTransactionIsolation(int level)
throws java.sql.SQLException
setTransactionIsolation in interface java.sql.Connectionjava.sql.SQLException
public int getTransactionIsolation()
throws java.sql.SQLException
getTransactionIsolation in interface java.sql.Connectionjava.sql.SQLException
public java.sql.SQLWarning getWarnings()
throws java.sql.SQLException
getWarnings in interface java.sql.Connectionjava.sql.SQLException
public void clearWarnings()
throws java.sql.SQLException
clearWarnings in interface java.sql.Connectionjava.sql.SQLException
public java.sql.CallableStatement prepareCall(java.lang.String sql,
int parm2,
int parm3,
int parm4)
throws java.sql.SQLException
prepareCall in interface java.sql.Connectionjava.sql.SQLException
public java.sql.PreparedStatement prepareStatement(java.lang.String sql,
java.lang.String[] parm2)
throws java.sql.SQLException
prepareStatement in interface java.sql.Connectionjava.sql.SQLException
public java.sql.PreparedStatement prepareStatement(java.lang.String sql,
int parm2)
throws java.sql.SQLException
prepareStatement in interface java.sql.Connectionjava.sql.SQLException
public java.sql.PreparedStatement prepareStatement(java.lang.String sql,
int[] parm2)
throws java.sql.SQLException
prepareStatement in interface java.sql.Connectionjava.sql.SQLException
public java.sql.PreparedStatement prepareStatement(java.lang.String sql,
int parm2,
int parm3,
int parm4)
throws java.sql.SQLException
prepareStatement in interface java.sql.Connectionjava.sql.SQLException
public java.sql.Statement createStatement(int parm1,
int parm2,
int parm3)
throws java.sql.SQLException
createStatement in interface java.sql.Connectionjava.sql.SQLException
public int getHoldability()
throws java.sql.SQLException
getHoldability in interface java.sql.Connectionjava.sql.SQLException
public void setHoldability(int parm1)
throws java.sql.SQLException
setHoldability in interface java.sql.Connectionjava.sql.SQLException
public java.sql.Savepoint setSavepoint()
throws java.sql.SQLException
setSavepoint in interface java.sql.Connectionjava.sql.SQLException
public java.sql.Savepoint setSavepoint(java.lang.String savepnt)
throws java.sql.SQLException
setSavepoint in interface java.sql.Connectionjava.sql.SQLException
public void releaseSavepoint(java.sql.Savepoint savepnt)
throws java.sql.SQLException
releaseSavepoint in interface java.sql.Connectionjava.sql.SQLException
public void rollback(java.sql.Savepoint sp)
throws java.sql.SQLException
rollback in interface java.sql.Connectionjava.sql.SQLException
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||