org.shiftone.ooc.factory
Class SimpleDataSource

java.lang.Object
  extended byorg.shiftone.ooc.factory.SimpleDataSource
All Implemented Interfaces:
javax.sql.DataSource

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

Version:
$Revision: 1.4 $
Author:
Jeff Drost

Field Summary
static java.lang.String PARAM_DRIVER
           
static java.lang.String PARAM_URL
           
 
Constructor Summary
SimpleDataSource(java.lang.String driverClassName, java.lang.String url, java.util.Properties baseProps)
          Constructor SimpleDataSource
 
Method Summary
 java.sql.Connection getConnection()
          Method getConnection
 java.sql.Connection getConnection(java.lang.String username, java.lang.String password)
          Method getConnection
 int getLoginTimeout()
          Method getLoginTimeout
 java.io.PrintWriter getLogWriter()
          Method getLogWriter
static javax.sql.DataSource newInstance(javax.naming.Reference ref)
          This is a helper method that can create a datasource from a JNDI reference.
 void setLoginTimeout(int seconds)
          Method setLoginTimeout
 void setLogWriter(java.io.PrintWriter out)
          Method setLogWriter
 java.lang.String toString()
          Method toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

PARAM_DRIVER

public static final java.lang.String PARAM_DRIVER
See Also:
Constant Field Values

PARAM_URL

public static final java.lang.String PARAM_URL
See Also:
Constant Field Values
Constructor Detail

SimpleDataSource

public SimpleDataSource(java.lang.String driverClassName,
                        java.lang.String url,
                        java.util.Properties baseProps)
Constructor SimpleDataSource

Parameters:
driverClassName -
url -
baseProps -
Method Detail

newInstance

public static javax.sql.DataSource newInstance(javax.naming.Reference ref)
This is a helper method that can create a datasource from a JNDI reference. This reference MUST contain RefAddrs "driver" and "url". All other RefAddrs will be passed on to the driver when the DataSource is asked to create a connection.

Parameters:
ref -
Returns:

toString

public java.lang.String toString()
Method toString


getConnection

public java.sql.Connection getConnection()
                                  throws java.sql.SQLException
Method getConnection

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

getConnection

public java.sql.Connection getConnection(java.lang.String username,
                                         java.lang.String password)
                                  throws java.sql.SQLException
Method getConnection

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

getLoginTimeout

public int getLoginTimeout()
                    throws java.sql.SQLException
Method getLoginTimeout

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

setLoginTimeout

public void setLoginTimeout(int seconds)
                     throws java.sql.SQLException
Method setLoginTimeout

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

getLogWriter

public java.io.PrintWriter getLogWriter()
                                 throws java.sql.SQLException
Method getLogWriter

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

setLogWriter

public void setLogWriter(java.io.PrintWriter out)
                  throws java.sql.SQLException
Method setLogWriter

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