org.apache.avalon.excalibur.datasource
Class JdbcConnection

java.lang.Object
  |
  +--org.apache.avalon.framework.logger.AbstractLoggable
        |
        +--org.apache.avalon.excalibur.datasource.JdbcConnection
All Implemented Interfaces:
java.sql.Connection, Disposable, Loggable, Poolable, Recyclable

public final class JdbcConnection
extends AbstractLoggable
implements java.sql.Connection, Recyclable, Disposable

The Connection object used in conjunction with the JdbcDataSource object. TODO: Implement a configurable closed end Pool, where the Connection acts like JDBC PooledConnections work. That means we can limit the total number of Connection objects that are created.

Version:
CVS $Revision: 1.3 $ $Date: 2001/05/25 17:13:18 $
Author:
Berin Loritsch

Fields inherited from interface java.sql.Connection
TRANSACTION_NONE, TRANSACTION_READ_COMMITTED, TRANSACTION_READ_UNCOMMITTED, TRANSACTION_REPEATABLE_READ, TRANSACTION_SERIALIZABLE
 
Constructor Summary
JdbcConnection(java.sql.Connection connection, boolean oradb)
           
 
Method Summary
 void clearWarnings()
           
 void close()
           
 void commit()
           
 java.sql.Statement createStatement()
           
 java.sql.Statement createStatement(int resultSetType, int resultSetConcurrency)
           
 void dispose()
          The dispose operation is called at the end of a components lifecycle.
 boolean getAutoCommit()
           
 java.lang.String getCatalog()
           
 java.sql.DatabaseMetaData getMetaData()
           
 int getTransactionIsolation()
           
 java.util.Map getTypeMap()
           
 java.sql.SQLWarning getWarnings()
           
 boolean isClosed()
           
 boolean isReadOnly()
           
 java.lang.String nativeSQL(java.lang.String sql)
           
 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)
           
 void recycle()
          This method should be implemented to remove all costly resources in object.
 void rollback()
           
 void setAutoCommit(boolean autoCommit)
           
 void setCatalog(java.lang.String catalog)
           
 void setLogger(org.apache.log.Logger log)
          Set the components logger.
protected  void setPool(Pool pool)
           
 void setReadOnly(boolean readOnly)
           
 void setTransactionIsolation(int level)
           
 void setTypeMap(java.util.Map map)
           
 
Methods inherited from class org.apache.avalon.framework.logger.AbstractLoggable
getLogger, setupLogger, setupLogger, setupLogger
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JdbcConnection

public JdbcConnection(java.sql.Connection connection,
                      boolean oradb)
Method Detail

setPool

protected void setPool(Pool pool)

setLogger

public final void setLogger(org.apache.log.Logger log)
Description copied from class: AbstractLoggable
Set the components logger.
Overrides:
setLogger in class AbstractLoggable
Following copied from class: org.apache.avalon.framework.logger.AbstractLoggable
Parameters:
logger - the logger

createStatement

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

prepareStatement

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

prepareCall

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

nativeSQL

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

setAutoCommit

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

getAutoCommit

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

commit

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

rollback

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

close

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

dispose

public final void dispose()
Description copied from interface: Disposable
The dispose operation is called at the end of a components lifecycle. This method will be called after Startable.stop() method (if implemented by component). Components use this method to release and destroy any resources that the Component owns.
Specified by:
dispose in interface Disposable

recycle

public final void recycle()
Description copied from interface: Recyclable
This method should be implemented to remove all costly resources in object. These resources can be object references, database connections, threads etc. What is categorised as "costly" resources is determined on a case by case analysis.
Specified by:
recycle in interface Recyclable

isClosed

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

getMetaData

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

setReadOnly

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

isReadOnly

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

setCatalog

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

getCatalog

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

setTransactionIsolation

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

getTransactionIsolation

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

getWarnings

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

clearWarnings

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

createStatement

public final java.sql.Statement createStatement(int resultSetType,
                                                int resultSetConcurrency)
                                         throws java.sql.SQLException
Specified by:
createStatement in interface java.sql.Connection

prepareStatement

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

prepareCall

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

getTypeMap

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

setTypeMap

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


Copyright © 2001 Apache Jakarta Project. All Rights Reserved.