com.knowgate.jdc
Class JDCConnection

java.lang.Object
  extended by com.knowgate.jdc.JDCConnection
All Implemented Interfaces:
java.sql.Connection, java.sql.Wrapper, javax.sql.PooledConnection

public final class JDCConnection
extends java.lang.Object
implements java.sql.Connection, javax.sql.PooledConnection

JDBC Connection Wrapper


Field Summary
static int DBMS_ACCESS
           
static int DBMS_GENERIC
           
static int DBMS_MSSQL
           
static int DBMS_MYSQL
           
static int DBMS_ORACLE
           
static int DBMS_POSTGRESQL
           
static int DBMS_SQLITE
           
static int DBMS_XBASE
           
static short IdClass
           
 
Fields inherited from interface java.sql.Connection
TRANSACTION_NONE, TRANSACTION_READ_COMMITTED, TRANSACTION_READ_UNCOMMITTED, TRANSACTION_REPEATABLE_READ, TRANSACTION_SERIALIZABLE
 
Constructor Summary
JDCConnection(java.sql.Connection conn, JDCConnectionPool pool)
           
JDCConnection(java.sql.Connection conn, JDCConnectionPool pool, java.lang.String schemaname)
           
 
Method Summary
 void addConnectionEventListener(javax.sql.ConnectionEventListener listener)
           
 void addStatementEventListener(javax.sql.StatementEventListener listener)
           
 void bindParameter(java.sql.PreparedStatement oStmt, int iParamIndex, java.lang.Object oParamValue)
           
 void bindParameter(java.sql.PreparedStatement oStmt, int iParamIndex, java.lang.Object oParamValue, int iSQLType)
          Bind parameter into a PreparedStatement
 void clearWarnings()
           
 void close()
           
 void close(java.lang.String sCaller)
           
 void commit()
           
 java.sql.Array createArrayOf(java.lang.String typeName, java.lang.Object[] attributes)
           
 java.sql.Blob createBlob()
           
 java.sql.Clob createClob()
           
 java.sql.NClob createNClob()
           
 java.sql.SQLXML createSQLXML()
           
 java.sql.Statement createStatement()
           
 java.sql.Statement createStatement(int i, int j)
           
 java.sql.Statement createStatement(int i, int j, int k)
           
 java.sql.Struct createStruct(java.lang.String typeName, java.lang.Object[] attributes)
           
 void dispose()
           
 void dispose(java.lang.String sCaller)
           
 boolean exists(java.lang.String sObjectName, java.lang.String sObjectType)
          Checks if an object exists at database Checking is done directly against database catalog tables, if current user does not have enought priviledges for reading database catalog tables methos may fail or return a wrong result.
protected  void expireLease()
           
 boolean getAutoCommit()
           
 java.lang.String getCatalog()
           
 java.util.Properties getClientInfo()
           
 java.lang.String getClientInfo(java.lang.String name)
           
 java.sql.Connection getConnection()
           
 int getDataBaseProduct()
           
static int getDataBaseProduct(java.sql.Connection conn)
           
 int getHoldability()
           
 long getLastUse()
           
 java.sql.DatabaseMetaData getMetaData()
           
 java.lang.String getName()
           
 JDCConnectionPool getPool()
           
 java.lang.String getSchemaName()
           
 int getTransactionIsolation()
           
 java.util.Map getTypeMap()
           
 java.sql.SQLWarning getWarnings()
           
 boolean inUse()
           
 boolean isClosed()
           
 boolean isReadOnly()
           
 boolean isValid(int timeout)
           
 boolean isWrapperFor(java.lang.Class c)
           
 boolean lease(java.lang.String sConnectionName)
           
 java.lang.String nativeSQL(java.lang.String sql)
           
protected  void notifyClose()
           
 java.lang.String pid()
          Get operating system process identifier for this connection
 java.sql.CallableStatement prepareCall(java.lang.String sql)
           
 java.sql.CallableStatement prepareCall(java.lang.String sql, int i, int j)
           
 java.sql.CallableStatement prepareCall(java.lang.String sql, int i, int j, int k)
           
 java.sql.PreparedStatement prepareStatement(java.lang.String sql)
           
 java.sql.PreparedStatement prepareStatement(java.lang.String sql, int i)
           
 java.sql.PreparedStatement prepareStatement(java.lang.String sql, int[] params)
           
 java.sql.PreparedStatement prepareStatement(java.lang.String sql, int i, int j)
           
 java.sql.PreparedStatement prepareStatement(java.lang.String sql, int i, int j, int k)
           
 java.sql.PreparedStatement prepareStatement(java.lang.String sql, java.lang.String[] params)
           
 void releaseSavepoint(java.sql.Savepoint p)
           
 void removeConnectionEventListener(javax.sql.ConnectionEventListener listener)
           
 void removeStatementEventListener(javax.sql.StatementEventListener listener)
           
 void rollback()
           
 void rollback(java.sql.Savepoint p)
           
 void setAutoCommit(boolean autoCommit)
           
 void setCatalog(java.lang.String catalog)
           
 void setClientInfo(java.util.Properties props)
           
 void setClientInfo(java.lang.String name, java.lang.String value)
           
 void setHoldability(int h)
           
 void setReadOnly(boolean readOnly)
           
 java.sql.Savepoint setSavepoint()
           
 java.sql.Savepoint setSavepoint(java.lang.String s)
           
 void setSchemaName(java.lang.String sname)
           
 void setTransactionIsolation(int level)
           
 void setTypeMap(java.util.Map typemap)
           
 java.lang.Object unwrap(java.lang.Class c)
           
 boolean validate()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

IdClass

public static final short IdClass
See Also:
Constant Field Values

DBMS_GENERIC

public static final int DBMS_GENERIC
See Also:
Constant Field Values

DBMS_MYSQL

public static final int DBMS_MYSQL
See Also:
Constant Field Values

DBMS_POSTGRESQL

public static final int DBMS_POSTGRESQL
See Also:
Constant Field Values

DBMS_MSSQL

public static final int DBMS_MSSQL
See Also:
Constant Field Values

DBMS_ORACLE

public static final int DBMS_ORACLE
See Also:
Constant Field Values

DBMS_XBASE

public static final int DBMS_XBASE
See Also:
Constant Field Values

DBMS_ACCESS

public static final int DBMS_ACCESS
See Also:
Constant Field Values

DBMS_SQLITE

public static final int DBMS_SQLITE
See Also:
Constant Field Values
Constructor Detail

JDCConnection

public JDCConnection(java.sql.Connection conn,
                     JDCConnectionPool pool,
                     java.lang.String schemaname)

JDCConnection

public JDCConnection(java.sql.Connection conn,
                     JDCConnectionPool pool)
Method Detail

addConnectionEventListener

public void addConnectionEventListener(javax.sql.ConnectionEventListener listener)
Specified by:
addConnectionEventListener in interface javax.sql.PooledConnection

removeConnectionEventListener

public void removeConnectionEventListener(javax.sql.ConnectionEventListener listener)
Specified by:
removeConnectionEventListener in interface javax.sql.PooledConnection

notifyClose

protected void notifyClose()

addStatementEventListener

public void addStatementEventListener(javax.sql.StatementEventListener listener)
Specified by:
addStatementEventListener in interface javax.sql.PooledConnection

removeStatementEventListener

public void removeStatementEventListener(javax.sql.StatementEventListener listener)
Specified by:
removeStatementEventListener in interface javax.sql.PooledConnection

lease

public boolean lease(java.lang.String sConnectionName)

validate

public boolean validate()

inUse

public boolean inUse()

getPool

public JDCConnectionPool getPool()

getLastUse

public long getLastUse()

getName

public java.lang.String getName()

getDataBaseProduct

public static int getDataBaseProduct(java.sql.Connection conn)
                              throws java.sql.SQLException
Throws:
java.sql.SQLException

getDataBaseProduct

public int getDataBaseProduct()
                       throws java.sql.SQLException
Throws:
java.sql.SQLException

getSchemaName

public java.lang.String getSchemaName()
                               throws java.sql.SQLException
Throws:
java.sql.SQLException

setSchemaName

public void setSchemaName(java.lang.String sname)

close

public void close()
           throws java.sql.SQLException
Specified by:
close in interface java.sql.Connection
Specified by:
close in interface javax.sql.PooledConnection
Throws:
java.sql.SQLException

close

public void close(java.lang.String sCaller)
           throws java.sql.SQLException
Throws:
java.sql.SQLException

dispose

public void dispose()

dispose

public void dispose(java.lang.String sCaller)

expireLease

protected void expireLease()

getConnection

public java.sql.Connection getConnection()
Specified by:
getConnection in interface javax.sql.PooledConnection

isWrapperFor

public boolean isWrapperFor(java.lang.Class c)
Specified by:
isWrapperFor in interface java.sql.Wrapper

unwrap

public java.lang.Object unwrap(java.lang.Class c)
Specified by:
unwrap in interface java.sql.Wrapper

createArrayOf

public java.sql.Array createArrayOf(java.lang.String typeName,
                                    java.lang.Object[] attributes)
                             throws java.sql.SQLException
Specified by:
createArrayOf in interface java.sql.Connection
Throws:
java.sql.SQLException

createBlob

public java.sql.Blob createBlob()
                         throws java.sql.SQLException
Specified by:
createBlob in interface java.sql.Connection
Throws:
java.sql.SQLException

createClob

public java.sql.Clob createClob()
                         throws java.sql.SQLException
Specified by:
createClob in interface java.sql.Connection
Throws:
java.sql.SQLException

createNClob

public java.sql.NClob createNClob()
                           throws java.sql.SQLException
Specified by:
createNClob in interface java.sql.Connection
Throws:
java.sql.SQLException

createStruct

public java.sql.Struct createStruct(java.lang.String typeName,
                                    java.lang.Object[] attributes)
                             throws java.sql.SQLException
Specified by:
createStruct in interface java.sql.Connection
Throws:
java.sql.SQLException

createSQLXML

public java.sql.SQLXML createSQLXML()
                             throws java.sql.SQLException,
                                    java.sql.SQLFeatureNotSupportedException
Specified by:
createSQLXML in interface java.sql.Connection
Throws:
java.sql.SQLException
java.sql.SQLFeatureNotSupportedException

createStatement

public java.sql.Statement createStatement(int i,
                                          int j)
                                   throws java.sql.SQLException
Specified by:
createStatement in interface java.sql.Connection
Throws:
java.sql.SQLException

createStatement

public java.sql.Statement createStatement(int i,
                                          int j,
                                          int k)
                                   throws java.sql.SQLException
Specified by:
createStatement in interface java.sql.Connection
Throws:
java.sql.SQLException

prepareStatement

public java.sql.PreparedStatement prepareStatement(java.lang.String sql)
                                            throws java.sql.SQLException
Specified by:
prepareStatement in interface java.sql.Connection
Throws:
java.sql.SQLException

prepareStatement

public java.sql.PreparedStatement prepareStatement(java.lang.String sql,
                                                   java.lang.String[] params)
                                            throws java.sql.SQLException
Specified by:
prepareStatement in interface java.sql.Connection
Throws:
java.sql.SQLException

prepareStatement

public java.sql.PreparedStatement prepareStatement(java.lang.String sql,
                                                   int i)
                                            throws java.sql.SQLException
Specified by:
prepareStatement in interface java.sql.Connection
Throws:
java.sql.SQLException

prepareStatement

public java.sql.PreparedStatement prepareStatement(java.lang.String sql,
                                                   int i,
                                                   int j)
                                            throws java.sql.SQLException
Specified by:
prepareStatement in interface java.sql.Connection
Throws:
java.sql.SQLException

prepareStatement

public java.sql.PreparedStatement prepareStatement(java.lang.String sql,
                                                   int i,
                                                   int j,
                                                   int k)
                                            throws java.sql.SQLException
Specified by:
prepareStatement in interface java.sql.Connection
Throws:
java.sql.SQLException

prepareStatement

public java.sql.PreparedStatement prepareStatement(java.lang.String sql,
                                                   int[] params)
                                            throws java.sql.SQLException
Specified by:
prepareStatement in interface java.sql.Connection
Throws:
java.sql.SQLException

prepareCall

public java.sql.CallableStatement prepareCall(java.lang.String sql)
                                       throws java.sql.SQLException
Specified by:
prepareCall in interface java.sql.Connection
Throws:
java.sql.SQLException

prepareCall

public java.sql.CallableStatement prepareCall(java.lang.String sql,
                                              int i,
                                              int j)
                                       throws java.sql.SQLException
Specified by:
prepareCall in interface java.sql.Connection
Throws:
java.sql.SQLException

prepareCall

public java.sql.CallableStatement prepareCall(java.lang.String sql,
                                              int i,
                                              int j,
                                              int k)
                                       throws java.sql.SQLException
Specified by:
prepareCall in interface java.sql.Connection
Throws:
java.sql.SQLException

createStatement

public java.sql.Statement createStatement()
                                   throws java.sql.SQLException
Specified by:
createStatement in interface java.sql.Connection
Throws:
java.sql.SQLException

nativeSQL

public java.lang.String nativeSQL(java.lang.String sql)
                           throws java.sql.SQLException
Specified by:
nativeSQL in interface java.sql.Connection
Throws:
java.sql.SQLException

getClientInfo

public java.util.Properties getClientInfo()
                                   throws java.sql.SQLException
Specified by:
getClientInfo in interface java.sql.Connection
Throws:
java.sql.SQLException

setClientInfo

public void setClientInfo(java.util.Properties props)
                   throws java.sql.SQLClientInfoException
Specified by:
setClientInfo in interface java.sql.Connection
Throws:
java.sql.SQLClientInfoException

getClientInfo

public java.lang.String getClientInfo(java.lang.String name)
                               throws java.sql.SQLException
Specified by:
getClientInfo in interface java.sql.Connection
Throws:
java.sql.SQLException

setClientInfo

public void setClientInfo(java.lang.String name,
                          java.lang.String value)
Specified by:
setClientInfo in interface java.sql.Connection

setAutoCommit

public void setAutoCommit(boolean autoCommit)
                   throws java.sql.SQLException
Specified by:
setAutoCommit in interface java.sql.Connection
Throws:
java.sql.SQLException

getAutoCommit

public boolean getAutoCommit()
                      throws java.sql.SQLException
Specified by:
getAutoCommit in interface java.sql.Connection
Throws:
java.sql.SQLException

getHoldability

public int getHoldability()
                   throws java.sql.SQLException
Specified by:
getHoldability in interface java.sql.Connection
Throws:
java.sql.SQLException

setHoldability

public void setHoldability(int h)
                    throws java.sql.SQLException
Specified by:
setHoldability in interface java.sql.Connection
Throws:
java.sql.SQLException

setSavepoint

public java.sql.Savepoint setSavepoint()
                                throws java.sql.SQLException
Specified by:
setSavepoint in interface java.sql.Connection
Throws:
java.sql.SQLException

setSavepoint

public java.sql.Savepoint setSavepoint(java.lang.String s)
                                throws java.sql.SQLException
Specified by:
setSavepoint in interface java.sql.Connection
Throws:
java.sql.SQLException

commit

public void commit()
            throws java.sql.SQLException
Specified by:
commit in interface java.sql.Connection
Throws:
java.sql.SQLException

rollback

public void rollback()
              throws java.sql.SQLException
Specified by:
rollback in interface java.sql.Connection
Throws:
java.sql.SQLException

rollback

public void rollback(java.sql.Savepoint p)
              throws java.sql.SQLException
Specified by:
rollback in interface java.sql.Connection
Throws:
java.sql.SQLException

isClosed

public boolean isClosed()
                 throws java.sql.SQLException
Specified by:
isClosed in interface java.sql.Connection
Throws:
java.sql.SQLException

isValid

public boolean isValid(int timeout)
                throws java.sql.SQLException
Specified by:
isValid in interface java.sql.Connection
Throws:
java.sql.SQLException

getMetaData

public java.sql.DatabaseMetaData getMetaData()
                                      throws java.sql.SQLException
Specified by:
getMetaData in interface java.sql.Connection
Throws:
java.sql.SQLException

setReadOnly

public void setReadOnly(boolean readOnly)
                 throws java.sql.SQLException
Specified by:
setReadOnly in interface java.sql.Connection
Throws:
java.sql.SQLException

isReadOnly

public boolean isReadOnly()
                   throws java.sql.SQLException
Specified by:
isReadOnly in interface java.sql.Connection
Throws:
java.sql.SQLException

setCatalog

public void setCatalog(java.lang.String catalog)
                throws java.sql.SQLException
Specified by:
setCatalog in interface java.sql.Connection
Throws:
java.sql.SQLException

getCatalog

public java.lang.String getCatalog()
                            throws java.sql.SQLException
Specified by:
getCatalog in interface java.sql.Connection
Throws:
java.sql.SQLException

setTransactionIsolation

public void setTransactionIsolation(int level)
                             throws java.sql.SQLException
Specified by:
setTransactionIsolation in interface java.sql.Connection
Throws:
java.sql.SQLException

getTransactionIsolation

public int getTransactionIsolation()
                            throws java.sql.SQLException
Specified by:
getTransactionIsolation in interface java.sql.Connection
Throws:
java.sql.SQLException

getTypeMap

public java.util.Map getTypeMap()
                         throws java.sql.SQLException
Specified by:
getTypeMap in interface java.sql.Connection
Throws:
java.sql.SQLException

setTypeMap

public void setTypeMap(java.util.Map typemap)
                throws java.sql.SQLException
Specified by:
setTypeMap in interface java.sql.Connection
Throws:
java.sql.SQLException

getWarnings

public java.sql.SQLWarning getWarnings()
                                throws java.sql.SQLException
Specified by:
getWarnings in interface java.sql.Connection
Throws:
java.sql.SQLException

clearWarnings

public void clearWarnings()
                   throws java.sql.SQLException
Specified by:
clearWarnings in interface java.sql.Connection
Throws:
java.sql.SQLException

releaseSavepoint

public void releaseSavepoint(java.sql.Savepoint p)
                      throws java.sql.SQLException
Specified by:
releaseSavepoint in interface java.sql.Connection
Throws:
java.sql.SQLException

exists

public boolean exists(java.lang.String sObjectName,
                      java.lang.String sObjectType)
               throws java.sql.SQLException,
                      java.lang.UnsupportedOperationException
Checks if an object exists at database Checking is done directly against database catalog tables, if current user does not have enought priviledges for reading database catalog tables methos may fail or return a wrong result.

Parameters:
sObjectName - Objeto name
sObjectType - Objeto type C = CHECK constraint D = Default or DEFAULT constraint F = FOREIGN KEY constraint L = Log P = Stored procedure PK = PRIMARY KEY constraint (type is K) RF = Replication filter stored procedure S = System table TR = Trigger U = User table UQ = UNIQUE constraint (type is K) V = View X = Extended stored procedure
Returns:
true if object exists, false otherwise
Throws:
java.sql.SQLException
java.lang.UnsupportedOperationException - If current database management system is not supported for this method

pid

public java.lang.String pid()
                     throws java.sql.SQLException

Get operating system process identifier for this connection

Returns:
String For PostgreSQL the id of the UNIX process attending this connection. For Oracle a Session Id.
Throws:
java.sql.SQLException
Since:
2.2

bindParameter

public void bindParameter(java.sql.PreparedStatement oStmt,
                          int iParamIndex,
                          java.lang.Object oParamValue,
                          int iSQLType)
                   throws java.sql.SQLException

Bind parameter into a PreparedStatement

Parameters:
oStmt - PreparedStatement where values is to be binded
iParamIndex - int Starting with 1
oParamValue - Object
iSQLType - int
Throws:
java.sql.SQLException

bindParameter

public void bindParameter(java.sql.PreparedStatement oStmt,
                          int iParamIndex,
                          java.lang.Object oParamValue)
                   throws java.sql.SQLException
Throws:
java.sql.SQLException