iiitToolkit 1.0

de.iiit.jdbc
Class JdbcConnection

java.lang.Object
  |
  +--de.iiit.jdbc.JdbcConnection

public class JdbcConnection
extends Object

This class holds a java.sql.connection. It should be used only inside this package. Therefore all methods are protected.

Version:
$Revision: 1.6 $ $Date: 2003/01/01 21:03:49 $

Constructor Summary
protected JdbcConnection(JdbcConnectionPool owner, Connection connection)
          Creates a new instance of JdbcConnection
 
Method Summary
protected  JdbcStatement createStatement()
          Creates a Statement object for sending SQL statements to the database.
protected  void destroyConnection()
          Do not move the connection to pool of free ones.
protected  void finalize()
          closes the encapsulated java.sql.Connection explicitly.
protected  JdbcDatabaseMetaData getMetaData()
          Retrieves a JdbcDatabaseMetaData object that contains metadata about the database to which this Connection object represents a connection.
protected  JdbcConnection lock()
          Lock a collection.
protected  JdbcPreparedStatement prepareStatement(String sql)
          Creates prepared statement
protected  void release()
          Release a previous lock.
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JdbcConnection

protected JdbcConnection(JdbcConnectionPool owner,
                         Connection connection)
Creates a new instance of JdbcConnection

Parameters:
owner - The owning JdbcConnectionPool
connection - The connection to the underlying database
Method Detail

lock

protected JdbcConnection lock()
Lock a collection. Every object except JdbcConnectionPools must lock a JdbcConnection a long as it uses it. As long as there are any locks on the Connection it is marked 'busy'.

Returns:
This.

release

protected void release()
Release a previous lock. When the the last lock on the connection is released the connection will be marked 'free' and is returned to the pool of free connections to be reused.


prepareStatement

protected JdbcPreparedStatement prepareStatement(String sql)
                                          throws JdbcException
Creates prepared statement

Parameters:
sql - an SQL statement that may contain one or more '?' IN parameter placeholders
Returns:
a new default JdbcPreparedStatement object containing the pre-compiled SQL statement
Throws:
JdbcException - if a database access error occurs

createStatement

protected JdbcStatement createStatement()
                                 throws JdbcException
Creates a Statement object for sending SQL statements to the database.

Returns:
a new default Statement object
Throws:
JdbcException - if a database access error occurs

getMetaData

protected JdbcDatabaseMetaData getMetaData()
                                    throws JdbcException
Retrieves a JdbcDatabaseMetaData object that contains metadata about the database to which this Connection object represents a connection.

Returns:
a JdbcDatabaseMetaData object for this Connection object
Throws:
JdbcException - if a database access error occurs

destroyConnection

protected void destroyConnection()
Do not move the connection to pool of free ones. This method must be called in case of an catched SQLException.


finalize

protected void finalize()
                 throws Throwable
closes the encapsulated java.sql.Connection explicitly.

Overrides:
finalize in class Object
Throws:
Throwable - Any throwable thrown during the excution.

iiitToolkit 1.0

Copyright © 2002, 2003 ingeneurbuero fuer innovative informationstechnik, Dipl.-Ing. Joerg Beckmann, Dortmund, Germany. All Rights Reserved.
See Copyright statement