Package net.sourceforge.jtds.jdbcx
Class PooledConnection
- java.lang.Object
-
- net.sourceforge.jtds.jdbcx.PooledConnection
-
- All Implemented Interfaces:
javax.sql.PooledConnection
- Direct Known Subclasses:
JtdsXAConnection
public class PooledConnection extends java.lang.Object implements javax.sql.PooledConnection
jTDS implementation of thePooledConnection
interface.- Version:
- $Id: PooledConnection.java,v 1.11.6.3 2009/12/30 08:45:34 ickzon Exp $
-
-
Field Summary
Fields Modifier and Type Field Description protected java.sql.Connection
connection
private java.util.ArrayList
listeners
-
Constructor Summary
Constructors Constructor Description PooledConnection(java.sql.Connection connection)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addConnectionEventListener(javax.sql.ConnectionEventListener listener)
Adds the specified listener to the list.void
addStatementEventListener(javax.sql.StatementEventListener listener)
void
close()
Closes the database connection.void
fireConnectionEvent(boolean closed, java.sql.SQLException sqlException)
Fires a new connection event on all listeners.java.sql.Connection
getConnection()
Returns a ConnectionProxy.void
removeConnectionEventListener(javax.sql.ConnectionEventListener listener)
Removes the specified listener from the list.void
removeStatementEventListener(javax.sql.StatementEventListener listener)
-
-
-
Method Detail
-
addConnectionEventListener
public void addConnectionEventListener(javax.sql.ConnectionEventListener listener)
Adds the specified listener to the list.- Specified by:
addConnectionEventListener
in interfacejavax.sql.PooledConnection
- See Also:
fireConnectionEvent(boolean, java.sql.SQLException)
,removeConnectionEventListener(javax.sql.ConnectionEventListener)
-
close
public void close() throws java.sql.SQLException
Closes the database connection.- Specified by:
close
in interfacejavax.sql.PooledConnection
- Throws:
java.sql.SQLException
- if an error occurs
-
fireConnectionEvent
public void fireConnectionEvent(boolean closed, java.sql.SQLException sqlException)
Fires a new connection event on all listeners.- Parameters:
closed
-true
ifclose
has been called on the connection;false
if thesqlException
represents an error where the connection may not longer be used.sqlException
- the SQLException to pass to the listeners
-
getConnection
public java.sql.Connection getConnection() throws java.sql.SQLException
Returns a ConnectionProxy.- Specified by:
getConnection
in interfacejavax.sql.PooledConnection
- Throws:
java.sql.SQLException
- if an error occurs
-
removeConnectionEventListener
public void removeConnectionEventListener(javax.sql.ConnectionEventListener listener)
Removes the specified listener from the list.- Specified by:
removeConnectionEventListener
in interfacejavax.sql.PooledConnection
- See Also:
addConnectionEventListener(javax.sql.ConnectionEventListener)
,fireConnectionEvent(boolean, java.sql.SQLException)
-
addStatementEventListener
public void addStatementEventListener(javax.sql.StatementEventListener listener)
- Specified by:
addStatementEventListener
in interfacejavax.sql.PooledConnection
-
removeStatementEventListener
public void removeStatementEventListener(javax.sql.StatementEventListener listener)
- Specified by:
removeStatementEventListener
in interfacejavax.sql.PooledConnection
-
-