com.caucho.sql
Class QPooledConnection

com.caucho.sql.QPooledConnection
All Implemented Interfaces:
java.sql.Connection

public class QPooledConnection
implements java.sql.Connection

Represents a single pooled connection. For the most part, it just passes the requests to the underlying JDBC connection.

Closing the connection will return the real connection to the pool and close any statements.


Fields inherited from interface java.sql.Connection
TRANSACTION_NONE, TRANSACTION_READ_COMMITTED, TRANSACTION_READ_UNCOMMITTED, TRANSACTION_REPEATABLE_READ, TRANSACTION_SERIALIZABLE
 
Method Summary
 void clearWarnings()
           
 void close()
          Reset the connection and return the underlying JDBC connection to the pool.
 void commit()
           
 void commit(com.caucho.sql.Xid xid, boolean onePhase)
          commit the resource
 java.sql.Statement createStatement()
          JDBC api to create a new statement.
 java.sql.Statement createStatement(int resultSetType, int resultSetConcurrency)
          JDBC api to create a new statement.
 void end(com.caucho.sql.Xid xid, int flags)
          ends work with the resource
 void finalize()
          If the user forgets to close the connection, make sure it's killed from the pool.
 void forget(com.caucho.sql.Xid xid)
          forget about the transaction
 boolean getAutoCommit()
           
 java.lang.String getCatalog()
          JDBC api to return the connection's catalog.
 java.sql.Connection getConnection()
          Returns the underlying connection.
 java.sql.DatabaseMetaData getMetaData()
          Gets the connection's metadata.
 int getTransactionIsolation()
           
 int getTransactionTimeout()
           
 java.util.Map getTypeMap()
          Returns the connection's type map.
 java.sql.SQLWarning getWarnings()
           
 boolean isClosed()
          Returns true if the connection is closed.
 boolean isReadOnly()
           
 boolean isSameRM(com.caucho.sql.XAResource resource)
          identity of resources
 java.lang.String nativeSQL(java.lang.String sql)
          Calls the nativeSQL method for the connection.
 int prepare(com.caucho.sql.Xid xid)
          Vote using phase-1 of the 2-phase commit.
 java.sql.CallableStatement prepareCall(java.lang.String sql)
           
 java.sql.CallableStatement prepareCall(java.lang.String sql, int resultSetType, int resultSetConcurrency)
           
 java.sql.PreparedStatement prepareStatement(java.lang.String sql)
           
 java.sql.PreparedStatement prepareStatement(java.lang.String sql, int resultSetType, int resultSetConcurrency)
           
 com.caucho.sql.Xid[] recover(int flag)
          recover the transaction
 void rollback()
           
 void rollback(com.caucho.sql.Xid xid)
          rollback the resource
 void setAutoCommit(boolean autoCommit)
           
 void setCatalog(java.lang.String catalog)
          Sets the JDBC catalog.
 void setReadOnly(boolean readOnly)
           
 void setTransactionIsolation(int isolation)
           
 boolean setTransactionTimeout(int seconds)
          sets the transaction timeout
 void setTypeMap(java.util.Map map)
          Sets the connection's type map.
 void start(com.caucho.sql.Xid xid, int flags)
          starts work on a transaction branch
 java.lang.String toString()
           
 

Method Detail

getConnection

public java.sql.Connection getConnection()
Returns the underlying connection.

createStatement

public java.sql.Statement createStatement()
                                   throws java.sql.SQLException
JDBC api to create a new statement. Any SQL exception thrown here will make the connection invalid, i.e. it can't be put back into the pool.
Specified by:
createStatement in interface java.sql.Connection
Returns:
a new JDBC statement.

createStatement

public java.sql.Statement createStatement(int resultSetType,
                                          int resultSetConcurrency)
                                   throws java.sql.SQLException
JDBC api to create a new statement. Any SQL exception thrown here will make the connection invalid, i.e. it can't be put back into the pool.
Specified by:
createStatement in interface java.sql.Connection
Returns:
a new JDBC statement.

getCatalog

public java.lang.String getCatalog()
                            throws java.sql.SQLException
JDBC api to return the connection's catalog.
Specified by:
getCatalog in interface java.sql.Connection
Returns:
the JDBC catalog.

setCatalog

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

getMetaData

public java.sql.DatabaseMetaData getMetaData()
                                      throws java.sql.SQLException
Gets the connection's metadata.
Specified by:
getMetaData in interface java.sql.Connection

getTypeMap

public java.util.Map getTypeMap()
                         throws java.sql.SQLException
Returns the connection's type map.
Specified by:
getTypeMap in interface java.sql.Connection

setTypeMap

public void setTypeMap(java.util.Map map)
                throws java.sql.SQLException
Sets the connection's type map.
Specified by:
setTypeMap in interface java.sql.Connection

nativeSQL

public java.lang.String nativeSQL(java.lang.String sql)
                           throws java.sql.SQLException
Calls the nativeSQL method for the connection.
Specified by:
nativeSQL in interface java.sql.Connection

getTransactionIsolation

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

setTransactionIsolation

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

getWarnings

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

clearWarnings

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

setReadOnly

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

isReadOnly

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

prepareCall

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

prepareCall

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

prepareStatement

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

prepareStatement

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

getAutoCommit

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

setAutoCommit

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

commit

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

rollback

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

isClosed

public boolean isClosed()
                 throws java.sql.SQLException
Returns true if the connection is closed.
Specified by:
isClosed in interface java.sql.Connection

close

public void close()
           throws java.sql.SQLException
Reset the connection and return the underlying JDBC connection to the pool.
Specified by:
close in interface java.sql.Connection

isSameRM

public boolean isSameRM(com.caucho.sql.XAResource resource)
                 throws com.caucho.sql.XAException
identity of resources

start

public void start(com.caucho.sql.Xid xid,
                  int flags)
           throws com.caucho.sql.XAException
starts work on a transaction branch

setTransactionTimeout

public boolean setTransactionTimeout(int seconds)
                              throws com.caucho.sql.XAException
sets the transaction timeout

getTransactionTimeout

public int getTransactionTimeout()
                          throws com.caucho.sql.XAException

forget

public void forget(com.caucho.sql.Xid xid)
            throws com.caucho.sql.XAException
forget about the transaction

prepare

public int prepare(com.caucho.sql.Xid xid)
            throws com.caucho.sql.XAException
Vote using phase-1 of the 2-phase commit.

rollback

public void rollback(com.caucho.sql.Xid xid)
              throws com.caucho.sql.XAException
rollback the resource

commit

public void commit(com.caucho.sql.Xid xid,
                   boolean onePhase)
            throws com.caucho.sql.XAException
commit the resource

recover

public com.caucho.sql.Xid[] recover(int flag)
                             throws com.caucho.sql.XAException
recover the transaction

end

public void end(com.caucho.sql.Xid xid,
                int flags)
ends work with the resource

finalize

public void finalize()
If the user forgets to close the connection, make sure it's killed from the pool.

toString

public java.lang.String toString()