Class SimpleDataSource.SimplePooledConnection

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

public static class SimpleDataSource.SimplePooledConnection extends Object implements InvocationHandler
--------------------------------------------------------------------------------------- SimplePooledConnection ---------------------------------------------------------------------------------------.
  • Constructor Details

    • SimplePooledConnection

      public 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 Details

    • 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:
    • 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:
    • createStatement

      public Statement createStatement() throws SQLException
      Creates the statement.
      Returns:
      the statement
      Throws:
      SQLException - the SQL exception
    • prepareStatement

      public PreparedStatement prepareStatement(String sql) throws SQLException
      Prepare statement.
      Parameters:
      sql - the sql
      Returns:
      the prepared statement
      Throws:
      SQLException - the SQL exception
    • prepareCall

      public CallableStatement prepareCall(String sql) throws SQLException
      Prepare call.
      Parameters:
      sql - the sql
      Returns:
      the callable statement
      Throws:
      SQLException - the SQL exception
    • nativeSQL

      public String nativeSQL(String sql) throws SQLException
      Native SQL.
      Parameters:
      sql - the sql
      Returns:
      the string
      Throws:
      SQLException - the SQL exception
    • setAutoCommit

      public void setAutoCommit(boolean autoCommit) throws SQLException
      Sets the auto commit.
      Parameters:
      autoCommit - the new auto commit
      Throws:
      SQLException - the SQL exception
    • getAutoCommit

      public boolean getAutoCommit() throws SQLException
      Gets the auto commit.
      Returns:
      the auto commit
      Throws:
      SQLException - the SQL exception
    • commit

      public void commit() throws SQLException
      Commit.
      Throws:
      SQLException - the SQL exception
    • rollback

      public void rollback() throws SQLException
      Rollback.
      Throws:
      SQLException - the SQL exception
    • close

      public void close() throws SQLException
      Close.
      Throws:
      SQLException - the SQL exception
    • isClosed

      public boolean isClosed() throws SQLException
      Checks if is closed.
      Returns:
      true, if is closed
      Throws:
      SQLException - the SQL exception
    • getMetaData

      public DatabaseMetaData getMetaData() throws SQLException
      Gets the meta data.
      Returns:
      the meta data
      Throws:
      SQLException - the SQL exception
    • setReadOnly

      public void setReadOnly(boolean readOnly) throws SQLException
      Sets the read only.
      Parameters:
      readOnly - the new read only
      Throws:
      SQLException - the SQL exception
    • isReadOnly

      public boolean isReadOnly() throws SQLException
      Checks if is read only.
      Returns:
      true, if is read only
      Throws:
      SQLException - the SQL exception
    • setCatalog

      public void setCatalog(String catalog) throws SQLException
      Sets the catalog.
      Parameters:
      catalog - the new catalog
      Throws:
      SQLException - the SQL exception
    • getCatalog

      public String getCatalog() throws SQLException
      Gets the catalog.
      Returns:
      the catalog
      Throws:
      SQLException - the SQL exception
    • setTransactionIsolation

      public void setTransactionIsolation(int level) throws SQLException
      Sets the transaction isolation.
      Parameters:
      level - the new transaction isolation
      Throws:
      SQLException - the SQL exception
    • getTransactionIsolation

      public int getTransactionIsolation() throws SQLException
      Gets the transaction isolation.
      Returns:
      the transaction isolation
      Throws:
      SQLException - the SQL exception
    • getWarnings

      public SQLWarning getWarnings() throws SQLException
      Gets the warnings.
      Returns:
      the warnings
      Throws:
      SQLException - the SQL exception
    • clearWarnings

      public void clearWarnings() throws SQLException
      Clear warnings.
      Throws:
      SQLException - the SQL exception
    • createStatement

      public Statement createStatement(int resultSetType, int resultSetConcurrency) throws SQLException
      Creates the statement.
      Parameters:
      resultSetType - the result set type
      resultSetConcurrency - the result set concurrency
      Returns:
      the statement
      Throws:
      SQLException - the SQL exception
    • prepareStatement

      public PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency) throws SQLException
      Prepare statement.
      Parameters:
      sql - the sql
      resultSetType - the result set type
      resultSetConcurrency - the result set concurrency
      Returns:
      the prepared statement
      Throws:
      SQLException - the SQL exception
    • prepareCall

      public CallableStatement prepareCall(String sql, int resultSetType, int resultSetConcurrency) throws SQLException
      Prepare call.
      Parameters:
      sql - the sql
      resultSetType - the result set type
      resultSetConcurrency - the result set concurrency
      Returns:
      the callable statement
      Throws:
      SQLException - the SQL exception
    • getTypeMap

      public Map getTypeMap() throws SQLException
      Gets the type map.
      Returns:
      the type map
      Throws:
      SQLException - the SQL exception
    • setTypeMap

      public void setTypeMap(Map map) throws SQLException
      Sets the type map.
      Parameters:
      map - the new type map
      Throws:
      SQLException - the SQL exception
    • setHoldability

      public void setHoldability(int holdability) throws SQLException
      Sets the holdability.
      Parameters:
      holdability - the new holdability
      Throws:
      SQLException - the SQL exception
    • getHoldability

      public int getHoldability() throws SQLException
      Gets the holdability.
      Returns:
      the holdability
      Throws:
      SQLException - the SQL exception
    • setSavepoint

      public Savepoint setSavepoint() throws SQLException
      Sets the savepoint.
      Returns:
      the savepoint
      Throws:
      SQLException - the SQL exception
    • setSavepoint

      public Savepoint setSavepoint(String name) throws SQLException
      Sets the savepoint.
      Parameters:
      name - the name
      Returns:
      the savepoint
      Throws:
      SQLException - the SQL exception
    • rollback

      public void rollback(Savepoint savepoint) throws SQLException
      Rollback.
      Parameters:
      savepoint - the savepoint
      Throws:
      SQLException - the SQL exception
    • releaseSavepoint

      public void releaseSavepoint(Savepoint savepoint) throws SQLException
      Release savepoint.
      Parameters:
      savepoint - the savepoint
      Throws:
      SQLException - the SQL exception
    • createStatement

      public Statement createStatement(int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException
      Creates the statement.
      Parameters:
      resultSetType - the result set type
      resultSetConcurrency - the result set concurrency
      resultSetHoldability - the result set holdability
      Returns:
      the statement
      Throws:
      SQLException - the SQL exception
    • prepareStatement

      public PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException
      Prepare statement.
      Parameters:
      sql - the sql
      resultSetType - the result set type
      resultSetConcurrency - the result set concurrency
      resultSetHoldability - the result set holdability
      Returns:
      the prepared statement
      Throws:
      SQLException - the SQL exception
    • prepareCall

      public CallableStatement prepareCall(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException
      Prepare call.
      Parameters:
      sql - the sql
      resultSetType - the result set type
      resultSetConcurrency - the result set concurrency
      resultSetHoldability - the result set holdability
      Returns:
      the callable statement
      Throws:
      SQLException - the SQL exception
    • prepareStatement

      public PreparedStatement prepareStatement(String sql, int autoGeneratedKeys) throws SQLException
      Prepare statement.
      Parameters:
      sql - the sql
      autoGeneratedKeys - the auto generated keys
      Returns:
      the prepared statement
      Throws:
      SQLException - the SQL exception
    • prepareStatement

      public PreparedStatement prepareStatement(String sql, int[] columnIndexes) throws SQLException
      Prepare statement.
      Parameters:
      sql - the sql
      columnIndexes - the column indexes
      Returns:
      the prepared statement
      Throws:
      SQLException - the SQL exception
    • prepareStatement

      public PreparedStatement prepareStatement(String sql, String[] columnNames) throws SQLException
      Prepare statement.
      Parameters:
      sql - the sql
      columnNames - the column names
      Returns:
      the prepared statement
      Throws:
      SQLException - the SQL exception