com.sibvisions.rad.persist.jdbc
Class DataSourceConnectionPool

java.lang.Object
  extended by com.sibvisions.rad.persist.jdbc.DataSourceConnectionPool
All Implemented Interfaces:
IConnectionPool

public class DataSourceConnectionPool
extends java.lang.Object
implements IConnectionPool

The IConnectionPool is an interface to allow simple custom connection pool implementations.

See Also:
DBAccess

Constructor Summary
DataSourceConnectionPool(javax.sql.DataSource pDataSource)
          Creates a new DataSourceConnectionPool.
DataSourceConnectionPool(javax.sql.DataSource pDataSource, java.lang.String pUsername, java.lang.String pPassword)
          Creates a new DataSourceConnectionPool.
 
Method Summary
protected static void debug(java.lang.Object... pInfo)
          Logs debug information.
 java.sql.Connection getConnection()
          Gets a connection from the pool.
 javax.sql.DataSource getDataSource()
          Gets the data source.
 java.lang.String getPassword()
          Gets the password.
 java.lang.String getUsername()
          Gets the user name.
 void releaseConnection(java.sql.Connection pConnection)
          Gets a connection from the pool.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DataSourceConnectionPool

public DataSourceConnectionPool(javax.sql.DataSource pDataSource)
Creates a new DataSourceConnectionPool.

Parameters:
pDataSource - the data source.

DataSourceConnectionPool

public DataSourceConnectionPool(javax.sql.DataSource pDataSource,
                                java.lang.String pUsername,
                                java.lang.String pPassword)
Creates a new DataSourceConnectionPool.

Parameters:
pDataSource - the data source.
pUsername - the username.
pPassword - the password.
Method Detail

getConnection

public java.sql.Connection getConnection()
                                  throws java.sql.SQLException
Gets a connection from the pool. The DBAccess ensures, that the connection is released, at least on closing the DBAccess.

Specified by:
getConnection in interface IConnectionPool
Returns:
the jdbc connection
Throws:
java.sql.SQLException - if connection is not available

releaseConnection

public void releaseConnection(java.sql.Connection pConnection)
Gets a connection from the pool. The DBAccess ensures, that the connection is released, at least on closing the DBAccess.

Specified by:
releaseConnection in interface IConnectionPool
Parameters:
pConnection - the jdbc connection

getDataSource

public javax.sql.DataSource getDataSource()
Gets the data source.

Returns:
the data source.

getUsername

public java.lang.String getUsername()
Gets the user name.

Returns:
the user name.

getPassword

public java.lang.String getPassword()
Gets the password.

Returns:
the password.

debug

protected static void debug(java.lang.Object... pInfo)
Logs debug information.

Parameters:
pInfo - the debug information


Copyright © 2009 SIB Visions GmbH. All Rights Reserved.