PageBoxLib
Class PoolEntry

java.lang.Object
  extended byPageBoxLib.PoolEntry
All Implemented Interfaces:
java.sql.Connection

class PoolEntry
extends java.lang.Object
implements java.sql.Connection

Connection class provided by the PageBox API.

Changes:

alexis.grandemange@pagebox.net

Copyright (c) 2002-2004 Alexis Grandemange

This program is free software; you can redistribute it and/or
 modify it under the terms of the GNU Lesser General Public License
 as published by the Free Software Foundation; version 2.1 of the
 License.
 This library is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 GNU Lesser General Public License for more details.
 A copy of the GNU Lesser General Public License lesser.txt should be
 included in the distribution.

Version:
0, 1, 0
Author:
Alexis Grandemange

Field Summary
private  boolean busy
          true when the connection is used.
private  java.sql.Connection conn
          JDBC connection
private  JDBCinfo jdbcInfo
          JDBCinfo object
private  Log log
          Logging object
(package private)  java.lang.SecurityManager sm
          Handle to the Security Manager.
private  java.lang.String source
          Logging source
(package private)  long timestamp
          Timestamp to close inactive connections
 
Fields inherited from interface java.sql.Connection
TRANSACTION_NONE, TRANSACTION_READ_COMMITTED, TRANSACTION_READ_UNCOMMITTED, TRANSACTION_REPEATABLE_READ, TRANSACTION_SERIALIZABLE
 
Constructor Summary
(package private) PoolEntry(JDBCinfo jdbcInfo, Log log, java.lang.String source)
          Constructor.
 
Method Summary
 void clearWarnings()
          Connection method.
 void close()
          Connection method.
 void commit()
          Connection method.
 java.sql.Statement createStatement()
          Connection method.
 java.sql.Statement createStatement(int resultSetType, int resultSetConcurrency)
          Connection method.
 java.sql.Statement createStatement(int resultSetType, int resultSetConcurrency, int resultSetHoldability)
          Connection method.
 boolean getAutoCommit()
          Connection method.
 java.lang.String getCatalog()
          Connection method.
 int getHoldability()
          Connection method.
 java.sql.DatabaseMetaData getMetaData()
          Connection method.
 int getTransactionIsolation()
          Connection method.
 java.util.Map getTypeMap()
          Connection method.
 java.sql.SQLWarning getWarnings()
          Connection method.
 boolean isClosed()
          Connection method.
(package private)  boolean isInactive()
          Closes the connection when it is inactive.
 boolean isReadOnly()
          Connection method.
(package private)  boolean lock()
          Called by APIImpl to lock a pool entry.
 java.lang.String nativeSQL(java.lang.String sql)
          Connection method.
 java.sql.CallableStatement prepareCall(java.lang.String sql)
          Connection method.
 java.sql.CallableStatement prepareCall(java.lang.String sql, int resultSetType, int resultSetConcurrency)
          Connection method.
 java.sql.CallableStatement prepareCall(java.lang.String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability)
          Connection method.
 java.sql.PreparedStatement prepareStatement(java.lang.String sql)
          Connection method.
 java.sql.PreparedStatement prepareStatement(java.lang.String sql, int autoGeneratedKeys)
          Connection method.
 java.sql.PreparedStatement prepareStatement(java.lang.String sql, int[] columnIndexes)
          Connection method.
 java.sql.PreparedStatement prepareStatement(java.lang.String sql, int resultSetType, int resultSetConcurrency)
          Connection method.
 java.sql.PreparedStatement prepareStatement(java.lang.String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability)
          Connection method.
 java.sql.PreparedStatement prepareStatement(java.lang.String sql, java.lang.String[] columnNames)
          Connection method.
(package private)  void release()
          Called by APIImpl to release a connection.
 void releaseSavepoint(java.sql.Savepoint savepoint)
          Connection method.
 void rollback()
          Connection method.
 void rollback(java.sql.Savepoint savepoint)
          Connection method.
 void setAutoCommit(boolean autoCommit)
          Connection method.
 void setCatalog(java.lang.String catalog)
          Connection method.
 void setHoldability(int holdability)
          Connection method.
 void setReadOnly(boolean readOnly)
          Connection method.
 java.sql.Savepoint setSavepoint()
          Connection method.
 java.sql.Savepoint setSavepoint(java.lang.String name)
          Connection method.
 void setTransactionIsolation(int level)
          Connection method.
 void setTypeMap(java.util.Map map)
          Connection method.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

busy

private boolean busy
true when the connection is used.


conn

private java.sql.Connection conn
JDBC connection


log

private Log log
Logging object


jdbcInfo

private JDBCinfo jdbcInfo
JDBCinfo object


source

private java.lang.String source
Logging source


sm

java.lang.SecurityManager sm
Handle to the Security Manager. Tested for null.


timestamp

long timestamp
Timestamp to close inactive connections

Constructor Detail

PoolEntry

PoolEntry(JDBCinfo jdbcInfo,
          Log log,
          java.lang.String source)
    throws java.sql.SQLException
Constructor.

Parameters:
jdbcInfo - JDBCinfo object
log - logging object
Method Detail

lock

boolean lock()
Called by APIImpl to lock a pool entry.


release

void release()
Called by APIImpl to release a connection.


clearWarnings

public void clearWarnings()
                   throws java.sql.SQLException
Connection method.

Specified by:
clearWarnings in interface java.sql.Connection
Throws:
java.sql.SQLException

close

public void close()
           throws java.sql.SQLException
Connection method. Recycle the connection.

Specified by:
close in interface java.sql.Connection
Throws:
java.sql.SQLException

commit

public void commit()
            throws java.sql.SQLException
Connection method.

Specified by:
commit in interface java.sql.Connection
Throws:
java.sql.SQLException

createStatement

public java.sql.Statement createStatement()
                                   throws java.sql.SQLException
Connection method.

Specified by:
createStatement in interface java.sql.Connection
Throws:
java.sql.SQLException

createStatement

public java.sql.Statement createStatement(int resultSetType,
                                          int resultSetConcurrency)
                                   throws java.sql.SQLException
Connection method.

Specified by:
createStatement in interface java.sql.Connection
Throws:
java.sql.SQLException

createStatement

public java.sql.Statement createStatement(int resultSetType,
                                          int resultSetConcurrency,
                                          int resultSetHoldability)
                                   throws java.sql.SQLException
Connection method.

Specified by:
createStatement in interface java.sql.Connection
Throws:
java.sql.SQLException

getAutoCommit

public boolean getAutoCommit()
                      throws java.sql.SQLException
Connection method.

Specified by:
getAutoCommit in interface java.sql.Connection
Throws:
java.sql.SQLException

getCatalog

public java.lang.String getCatalog()
                            throws java.sql.SQLException
Connection method.

Specified by:
getCatalog in interface java.sql.Connection
Throws:
java.sql.SQLException

getHoldability

public int getHoldability()
                   throws java.sql.SQLException
Connection method. Comment it when you use an old JDK.

Specified by:
getHoldability in interface java.sql.Connection
Throws:
java.sql.SQLException

getMetaData

public java.sql.DatabaseMetaData getMetaData()
                                      throws java.sql.SQLException
Connection method.

Specified by:
getMetaData in interface java.sql.Connection
Throws:
java.sql.SQLException

getTransactionIsolation

public int getTransactionIsolation()
                            throws java.sql.SQLException
Connection method.

Specified by:
getTransactionIsolation in interface java.sql.Connection
Throws:
java.sql.SQLException

getTypeMap

public java.util.Map getTypeMap()
                         throws java.sql.SQLException
Connection method.

Specified by:
getTypeMap in interface java.sql.Connection
Throws:
java.sql.SQLException

getWarnings

public java.sql.SQLWarning getWarnings()
                                throws java.sql.SQLException
Connection method.

Specified by:
getWarnings in interface java.sql.Connection
Throws:
java.sql.SQLException

isClosed

public boolean isClosed()
                 throws java.sql.SQLException
Connection method.

Specified by:
isClosed in interface java.sql.Connection
Throws:
java.sql.SQLException

isReadOnly

public boolean isReadOnly()
                   throws java.sql.SQLException
Connection method.

Specified by:
isReadOnly in interface java.sql.Connection
Throws:
java.sql.SQLException

nativeSQL

public java.lang.String nativeSQL(java.lang.String sql)
                           throws java.sql.SQLException
Connection method.

Specified by:
nativeSQL in interface java.sql.Connection
Throws:
java.sql.SQLException

prepareCall

public java.sql.CallableStatement prepareCall(java.lang.String sql)
                                       throws java.sql.SQLException
Connection method.

Specified by:
prepareCall in interface java.sql.Connection
Throws:
java.sql.SQLException

prepareCall

public java.sql.CallableStatement prepareCall(java.lang.String sql,
                                              int resultSetType,
                                              int resultSetConcurrency)
                                       throws java.sql.SQLException
Connection method.

Specified by:
prepareCall in interface java.sql.Connection
Throws:
java.sql.SQLException

prepareCall

public java.sql.CallableStatement prepareCall(java.lang.String sql,
                                              int resultSetType,
                                              int resultSetConcurrency,
                                              int resultSetHoldability)
                                       throws java.sql.SQLException
Connection method. Comment it when you use an old JDK.

Specified by:
prepareCall in interface java.sql.Connection
Throws:
java.sql.SQLException

prepareStatement

public java.sql.PreparedStatement prepareStatement(java.lang.String sql)
                                            throws java.sql.SQLException
Connection method.

Specified by:
prepareStatement in interface java.sql.Connection
Throws:
java.sql.SQLException

prepareStatement

public java.sql.PreparedStatement prepareStatement(java.lang.String sql,
                                                   int autoGeneratedKeys)
                                            throws java.sql.SQLException
Connection method. Comment it when you an old JDK.

Specified by:
prepareStatement in interface java.sql.Connection
Throws:
java.sql.SQLException

prepareStatement

public java.sql.PreparedStatement prepareStatement(java.lang.String sql,
                                                   int[] columnIndexes)
                                            throws java.sql.SQLException
Connection method. Comment it when you use an old JDK.

Specified by:
prepareStatement in interface java.sql.Connection
Throws:
java.sql.SQLException

prepareStatement

public java.sql.PreparedStatement prepareStatement(java.lang.String sql,
                                                   int resultSetType,
                                                   int resultSetConcurrency)
                                            throws java.sql.SQLException
Connection method.

Specified by:
prepareStatement in interface java.sql.Connection
Throws:
java.sql.SQLException

prepareStatement

public java.sql.PreparedStatement prepareStatement(java.lang.String sql,
                                                   int resultSetType,
                                                   int resultSetConcurrency,
                                                   int resultSetHoldability)
                                            throws java.sql.SQLException
Connection method. Comment it when you use an old JDK.

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[] columnNames)
                                            throws java.sql.SQLException
Connection method. Comment it when you use an old JDK.

Specified by:
prepareStatement in interface java.sql.Connection
Throws:
java.sql.SQLException

releaseSavepoint

public void releaseSavepoint(java.sql.Savepoint savepoint)
                      throws java.sql.SQLException
Connection method. Comment it when you use an old JDK.

Specified by:
releaseSavepoint in interface java.sql.Connection
Throws:
java.sql.SQLException

rollback

public void rollback()
              throws java.sql.SQLException
Connection method.

Specified by:
rollback in interface java.sql.Connection
Throws:
java.sql.SQLException

rollback

public void rollback(java.sql.Savepoint savepoint)
              throws java.sql.SQLException
Connection method. Comment it when you use an old JDK.

Specified by:
rollback in interface java.sql.Connection
Throws:
java.sql.SQLException

setAutoCommit

public void setAutoCommit(boolean autoCommit)
                   throws java.sql.SQLException
Connection method.

Specified by:
setAutoCommit in interface java.sql.Connection
Throws:
java.sql.SQLException

setCatalog

public void setCatalog(java.lang.String catalog)
                throws java.sql.SQLException
Connection method.

Specified by:
setCatalog in interface java.sql.Connection
Throws:
java.sql.SQLException

setHoldability

public void setHoldability(int holdability)
                    throws java.sql.SQLException
Connection method. Comment it when you use an old JDK.

Specified by:
setHoldability in interface java.sql.Connection
Throws:
java.sql.SQLException

setReadOnly

public void setReadOnly(boolean readOnly)
                 throws java.sql.SQLException
Connection method.

Specified by:
setReadOnly in interface java.sql.Connection
Throws:
java.sql.SQLException

setSavepoint

public java.sql.Savepoint setSavepoint()
                                throws java.sql.SQLException
Connection method. Comment it when you use an old JDK.

Specified by:
setSavepoint in interface java.sql.Connection
Throws:
java.sql.SQLException

setSavepoint

public java.sql.Savepoint setSavepoint(java.lang.String name)
                                throws java.sql.SQLException
Connection method.

Specified by:
setSavepoint in interface java.sql.Connection
Throws:
java.sql.SQLException

setTransactionIsolation

public void setTransactionIsolation(int level)
                             throws java.sql.SQLException
Connection method.

Specified by:
setTransactionIsolation in interface java.sql.Connection
Throws:
java.sql.SQLException

setTypeMap

public void setTypeMap(java.util.Map map)
                throws java.sql.SQLException
Connection method.

Specified by:
setTypeMap in interface java.sql.Connection
Throws:
java.sql.SQLException

isInactive

boolean isInactive()
Closes the connection when it is inactive. Called by APIImpl.

Returns:
true if the connection was closed and can be removed from the pool.