com.ora.jsp.sql
Class DataSourceWrapper
java.lang.Object
|
+--com.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 SE DataSource
interface, used to make the ConnectionPool class look like
a JDBC 2.0 DataSource.
- Version:
- 1.0
- Author:
- Hans Bergsten, Gefion software
Constructor Summary |
DataSourceWrapper(java.lang.String driverClass,
java.lang.String url,
java.lang.String user,
java.lang.String pw)
|
Method Summary |
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 a SQLException. |
int |
getLoginTimeout()
Always throws a SQLException. |
java.io.PrintWriter |
getLogWriter()
Always throws a SQLException. |
void |
returnConnection(java.sql.Connection conn)
Returns a Connection to the pool. |
void |
setLoginTimeout(int seconds)
Always throws a SQLException. |
void |
setLogWriter(java.io.PrintWriter out)
Always throws a SQLException. |
Methods inherited from class java.lang.Object |
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait |
pool
private ConnectionPool pool
DataSourceWrapper
public DataSourceWrapper(java.lang.String driverClass,
java.lang.String url,
java.lang.String user,
java.lang.String pw)
throws java.lang.ClassNotFoundException,
java.lang.InstantiationException,
java.sql.SQLException,
java.lang.IllegalAccessException
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
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 a SQLException. Username and password are set
in the constructor and can not be changed.
- Specified by:
getConnection
in interface javax.sql.DataSource
getLoginTimeout
public int getLoginTimeout()
throws java.sql.SQLException
- Always throws a SQLException. Not supported.
- Specified by:
getLoginTimeout
in interface javax.sql.DataSource
getLogWriter
public java.io.PrintWriter getLogWriter()
throws java.sql.SQLException
- Always throws a SQLException. Not supported.
- Specified by:
getLogWriter
in interface javax.sql.DataSource
setLoginTimeout
public void setLoginTimeout(int seconds)
throws java.sql.SQLException
- Always throws a SQLException. Not supported.
- Specified by:
setLoginTimeout
in interface javax.sql.DataSource
setLogWriter
public void setLogWriter(java.io.PrintWriter out)
throws java.sql.SQLException
- Always throws a SQLException. Not supported.
- Specified by:
setLogWriter
in interface javax.sql.DataSource