com.ibatis.common.jdbc
Class SimpleDataSource.SimplePooledConnection

java.lang.Object
  extended by com.ibatis.common.jdbc.SimpleDataSource.SimplePooledConnection
All Implemented Interfaces:
InvocationHandler
Enclosing class:
SimpleDataSource

public static class SimpleDataSource.SimplePooledConnection
extends Object
implements InvocationHandler

--------------------------------------------------------------------------------------- SimplePooledConnection ---------------------------------------------------------------------------------------


Constructor Summary
SimpleDataSource.SimplePooledConnection(Connection connection, SimpleDataSource dataSource)
          Constructor for SimplePooledConnection that uses the Connection and SimpleDataSource passed in
 
Method Summary
 void clearWarnings()
           
 void close()
           
 void commit()
           
 Statement createStatement()
           
 Statement createStatement(int resultSetType, int resultSetConcurrency)
           
 Statement createStatement(int resultSetType, int resultSetConcurrency, int resultSetHoldability)
           
 boolean equals(Object obj)
          Allows comparing this connection to another
 long getAge()
          Getter for the age of the connection
 boolean getAutoCommit()
           
 String getCatalog()
           
 long getCheckoutTime()
          Getter for the time that this connection has been checked out
 long getCheckoutTimestamp()
          Getter for the timestamp that this connection was checked out
 int getConnectionTypeCode()
          Getter for the connection type (based on url + user + password)
 long getCreatedTimestamp()
          Getter for the time that the connection was created
 int getHoldability()
           
 long getLastUsedTimestamp()
          Getter for the time that the connection was last used
 DatabaseMetaData getMetaData()
           
 Connection getProxyConnection()
          Getter for the proxy for the connection
 Connection getRealConnection()
          Getter for the *real* connection that this wraps
 int getRealHashCode()
          Gets the hashcode of the real connection (or 0 if it is null)
 long getTimeElapsedSinceLastUse()
          Getter for the time since this connection was last used
 int getTransactionIsolation()
           
 Map getTypeMap()
           
 SQLWarning getWarnings()
           
 int hashCode()
           
 void invalidate()
          Invalidates the connection
 Object invoke(Object proxy, Method method, Object[] args)
          Required for InvocationHandler implementation.
 boolean isClosed()
           
 boolean isReadOnly()
           
 boolean isValid()
          Method to see if the connection is usable
 String nativeSQL(String sql)
           
 CallableStatement prepareCall(String sql)
           
 CallableStatement prepareCall(String sql, int resultSetType, int resultSetConcurrency)
           
 CallableStatement prepareCall(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability)
           
 PreparedStatement prepareStatement(String sql)
           
 PreparedStatement prepareStatement(String sql, int autoGeneratedKeys)
           
 PreparedStatement prepareStatement(String sql, int[] columnIndexes)
           
 PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency)
           
 PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability)
           
 PreparedStatement prepareStatement(String sql, String[] columnNames)
           
 void releaseSavepoint(Savepoint savepoint)
           
 void rollback()
           
 void rollback(Savepoint savepoint)
           
 void setAutoCommit(boolean autoCommit)
           
 void setCatalog(String catalog)
           
 void setCheckoutTimestamp(long timestamp)
          Setter for the timestamp that this connection was checked out
 void setConnectionTypeCode(int connectionTypeCode)
          Setter for the connection type
 void setCreatedTimestamp(long createdTimestamp)
          Setter for the time that the connection was created
 void setHoldability(int holdability)
           
 void setLastUsedTimestamp(long lastUsedTimestamp)
          Setter for the time that the connection was last used
 void setReadOnly(boolean readOnly)
           
 Savepoint setSavepoint()
           
 Savepoint setSavepoint(String name)
           
 void setTransactionIsolation(int level)
           
 void setTypeMap(Map map)
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SimpleDataSource.SimplePooledConnection

public SimpleDataSource.SimplePooledConnection(Connection connection,
                                               SimpleDataSource dataSource)
Constructor for SimplePooledConnection that uses the Connection and SimpleDataSource passed in

Parameters:
connection - - the connection that is to be presented as a pooled connection
dataSource - - the dataSource that the connection is from
Method Detail

invalidate

public void invalidate()
Invalidates the connection


isValid

public boolean isValid()
Method to see if the connection is usable

Returns:
True if the connection is usable

getRealConnection

public Connection getRealConnection()
Getter for the *real* connection that this wraps

Returns:
The connection

getProxyConnection

public Connection getProxyConnection()
Getter for the proxy for the connection

Returns:
The proxy

getRealHashCode

public int getRealHashCode()
Gets the hashcode of the real connection (or 0 if it is null)

Returns:
The hashcode of the real connection (or 0 if it is null)

getConnectionTypeCode

public int getConnectionTypeCode()
Getter for the connection type (based on url + user + password)

Returns:
The connection type

setConnectionTypeCode

public void setConnectionTypeCode(int connectionTypeCode)
Setter for the connection type

Parameters:
connectionTypeCode - - the connection type

getCreatedTimestamp

public long getCreatedTimestamp()
Getter for the time that the connection was created

Returns:
The creation timestamp

setCreatedTimestamp

public void setCreatedTimestamp(long createdTimestamp)
Setter for the time that the connection was created

Parameters:
createdTimestamp - - the timestamp

getLastUsedTimestamp

public long getLastUsedTimestamp()
Getter for the time that the connection was last used

Returns:
- the timestamp

setLastUsedTimestamp

public void setLastUsedTimestamp(long lastUsedTimestamp)
Setter for the time that the connection was last used

Parameters:
lastUsedTimestamp - - the timestamp

getTimeElapsedSinceLastUse

public long getTimeElapsedSinceLastUse()
Getter for the time since this connection was last used

Returns:
- the time since the last use

getAge

public long getAge()
Getter for the age of the connection

Returns:
the age

getCheckoutTimestamp

public long getCheckoutTimestamp()
Getter for the timestamp that this connection was checked out

Returns:
the timestamp

setCheckoutTimestamp

public void setCheckoutTimestamp(long timestamp)
Setter for the timestamp that this connection was checked out

Parameters:
timestamp - the timestamp

getCheckoutTime

public long getCheckoutTime()
Getter for the time that this connection has been checked out

Returns:
the time

hashCode

public int hashCode()
Overrides:
hashCode in class Object

equals

public boolean equals(Object obj)
Allows comparing this connection to another

Overrides:
equals in class Object
Parameters:
obj - - the other connection to test for equality
See Also:
Object.equals(java.lang.Object)

invoke

public Object invoke(Object proxy,
                     Method method,
                     Object[] args)
              throws Throwable
Required for InvocationHandler implementation.

Specified by:
invoke in interface InvocationHandler
Parameters:
proxy - - not used
method - - the method to be executed
args - - the parameters to be passed to the method
Throws:
Throwable
See Also:
InvocationHandler.invoke(java.lang.Object, java.lang.reflect.Method, java.lang.Object[])

createStatement

public Statement createStatement()
                          throws SQLException
Throws:
SQLException

prepareStatement

public PreparedStatement prepareStatement(String sql)
                                   throws SQLException
Throws:
SQLException

prepareCall

public CallableStatement prepareCall(String sql)
                              throws SQLException
Throws:
SQLException

nativeSQL

public String nativeSQL(String sql)
                 throws SQLException
Throws:
SQLException

setAutoCommit

public void setAutoCommit(boolean autoCommit)
                   throws SQLException
Throws:
SQLException

getAutoCommit

public boolean getAutoCommit()
                      throws SQLException
Throws:
SQLException

commit

public void commit()
            throws SQLException
Throws:
SQLException

rollback

public void rollback()
              throws SQLException
Throws:
SQLException

close

public void close()
           throws SQLException
Throws:
SQLException

isClosed

public boolean isClosed()
                 throws SQLException
Throws:
SQLException

getMetaData

public DatabaseMetaData getMetaData()
                             throws SQLException
Throws:
SQLException

setReadOnly

public void setReadOnly(boolean readOnly)
                 throws SQLException
Throws:
SQLException

isReadOnly

public boolean isReadOnly()
                   throws SQLException
Throws:
SQLException

setCatalog

public void setCatalog(String catalog)
                throws SQLException
Throws:
SQLException

getCatalog

public String getCatalog()
                  throws SQLException
Throws:
SQLException

setTransactionIsolation

public void setTransactionIsolation(int level)
                             throws SQLException
Throws:
SQLException

getTransactionIsolation

public int getTransactionIsolation()
                            throws SQLException
Throws:
SQLException

getWarnings

public SQLWarning getWarnings()
                       throws SQLException
Throws:
SQLException

clearWarnings

public void clearWarnings()
                   throws SQLException
Throws:
SQLException

createStatement

public Statement createStatement(int resultSetType,
                                 int resultSetConcurrency)
                          throws SQLException
Throws:
SQLException

prepareStatement

public PreparedStatement prepareStatement(String sql,
                                          int resultSetType,
                                          int resultSetConcurrency)
                                   throws SQLException
Throws:
SQLException

prepareCall

public CallableStatement prepareCall(String sql,
                                     int resultSetType,
                                     int resultSetConcurrency)
                              throws SQLException
Throws:
SQLException

getTypeMap

public Map getTypeMap()
               throws SQLException
Throws:
SQLException

setTypeMap

public void setTypeMap(Map map)
                throws SQLException
Throws:
SQLException

setHoldability

public void setHoldability(int holdability)
                    throws SQLException
Throws:
SQLException

getHoldability

public int getHoldability()
                   throws SQLException
Throws:
SQLException

setSavepoint

public Savepoint setSavepoint()
                       throws SQLException
Throws:
SQLException

setSavepoint

public Savepoint setSavepoint(String name)
                       throws SQLException
Throws:
SQLException

rollback

public void rollback(Savepoint savepoint)
              throws SQLException
Throws:
SQLException

releaseSavepoint

public void releaseSavepoint(Savepoint savepoint)
                      throws SQLException
Throws:
SQLException

createStatement

public Statement createStatement(int resultSetType,
                                 int resultSetConcurrency,
                                 int resultSetHoldability)
                          throws SQLException
Throws:
SQLException

prepareStatement

public PreparedStatement prepareStatement(String sql,
                                          int resultSetType,
                                          int resultSetConcurrency,
                                          int resultSetHoldability)
                                   throws SQLException
Throws:
SQLException

prepareCall

public CallableStatement prepareCall(String sql,
                                     int resultSetType,
                                     int resultSetConcurrency,
                                     int resultSetHoldability)
                              throws SQLException
Throws:
SQLException

prepareStatement

public PreparedStatement prepareStatement(String sql,
                                          int autoGeneratedKeys)
                                   throws SQLException
Throws:
SQLException

prepareStatement

public PreparedStatement prepareStatement(String sql,
                                          int[] columnIndexes)
                                   throws SQLException
Throws:
SQLException

prepareStatement

public PreparedStatement prepareStatement(String sql,
                                          String[] columnNames)
                                   throws SQLException
Throws:
SQLException


Copyright © 2010. All Rights Reserved.