com.ora.jsp.sql
Class DataSourceWrapper

java.lang.Object
  extended bycom.ora.jsp.sql.DataSourceWrapper
All Implemented Interfaces:
javax.sql.DataSource

public class DataSourceWrapper
extends java.lang.Object
implements javax.sql.DataSource

This class is a wrapper implementing the JDBC 2.0 DataSource interface, used to make the ConnectionPool class look like a JDBC 2.0 DataSource.

Version:
2.0
Author:
Hans Bergsten, Gefion software

Field Summary
private  java.lang.String driverClassName
           
private  int initialConnections
           
private  java.lang.String password
           
private  ConnectionPool pool
           
private  java.lang.String url
           
private  java.lang.String user
           
 
Constructor Summary
DataSourceWrapper()
           
 
Method Summary
private  void createConnectionPool()
          Create a Connection pool based on the configuration properties.
 java.sql.Connection getConnection()
          Gets a connection from the pool and returns it wrapped in a ConnectionWrapper.
 java.sql.Connection getConnection(java.lang.String username, java.lang.String password)
          Always throws an SQLException.
 int getLoginTimeout()
          Always throws an SQLException.
 java.io.PrintWriter getLogWriter()
          Always throws an SQLException.
 void returnConnection(java.sql.Connection conn)
          Returns a Connection to the pool.
 void setDriverClassName(java.lang.String driverClassName)
          Sets the JDBC driver class name for the pool.
 void setInitialConnections(int initialConnections)
          Sets the number of connections to create when the pool is created.
 void setLoginTimeout(int seconds)
          Always throws an SQLException.
 void setLogWriter(java.io.PrintWriter out)
          Always throws an SQLException.
 void setPassword(java.lang.String password)
          Sets the user account password for the pool.
 void setUrl(java.lang.String url)
          Sets the JDBC URL for the pool.
 void setUser(java.lang.String user)
          Sets the user account for the pool.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

pool

private ConnectionPool pool

driverClassName

private java.lang.String driverClassName

url

private java.lang.String url

user

private java.lang.String user

password

private java.lang.String password

initialConnections

private int initialConnections
Constructor Detail

DataSourceWrapper

public DataSourceWrapper()
Method Detail

setDriverClassName

public void setDriverClassName(java.lang.String driverClassName)
Sets the JDBC driver class name for the pool.


setUrl

public void setUrl(java.lang.String url)
Sets the JDBC URL for the pool.


setUser

public void setUser(java.lang.String user)
Sets the user account for the pool.


setPassword

public void setPassword(java.lang.String password)
Sets the user account password for the pool.


setInitialConnections

public void setInitialConnections(int initialConnections)
Sets the number of connections to create when the pool is created.


getConnection

public java.sql.Connection getConnection()
                                  throws java.sql.SQLException
Gets a connection from the pool and returns it wrapped in a ConnectionWrapper.

Specified by:
getConnection in interface javax.sql.DataSource
Throws:
java.sql.SQLException

returnConnection

public void returnConnection(java.sql.Connection conn)
Returns a Connection to the pool. This method is called by the ConnectionWrapper's close() method.


getConnection

public java.sql.Connection getConnection(java.lang.String username,
                                         java.lang.String password)
                                  throws java.sql.SQLException
Always throws an SQLException. Username and password are set with the setter methods and can not be changed.

Specified by:
getConnection in interface javax.sql.DataSource
Throws:
java.sql.SQLException

getLoginTimeout

public int getLoginTimeout()
                    throws java.sql.SQLException
Always throws an SQLException. Not supported.

Specified by:
getLoginTimeout in interface javax.sql.DataSource
Throws:
java.sql.SQLException

getLogWriter

public java.io.PrintWriter getLogWriter()
                                 throws java.sql.SQLException
Always throws an SQLException. Not supported.

Specified by:
getLogWriter in interface javax.sql.DataSource
Throws:
java.sql.SQLException

setLoginTimeout

public void setLoginTimeout(int seconds)
                     throws java.sql.SQLException
Always throws an SQLException. Not supported.

Specified by:
setLoginTimeout in interface javax.sql.DataSource
Throws:
java.sql.SQLException

setLogWriter

public void setLogWriter(java.io.PrintWriter out)
                  throws java.sql.SQLException
Always throws an SQLException. Not supported.

Specified by:
setLogWriter in interface javax.sql.DataSource
Throws:
java.sql.SQLException

createConnectionPool

private void createConnectionPool()
                           throws java.sql.SQLException
Create a Connection pool based on the configuration properties.

Throws:
java.sql.SQLException