org.openejb.resource.jdbc
Class JdbcConnectionFactory

java.lang.Object
  extended by org.openejb.resource.jdbc.JdbcConnectionFactory
All Implemented Interfaces:
java.io.Serializable, javax.naming.Referenceable, javax.sql.DataSource

public class JdbcConnectionFactory
extends java.lang.Object
implements javax.sql.DataSource, javax.resource.Referenceable, java.io.Serializable

As a connection factory the JdbcConnecitonFactory must implement the Serializable and Referenceable methods so that it can be store in a JNDI name space. The reference itself is an application specific object that can be used to lookup and configure a new ManagedConnectionFactory the JdbcConnecitonFactory is only a store for this reference, its not expected to be functional after it has been serialized into a JNDI namespace.

See section 10.5.3 of the J2EE Connector Architecture 1.0 spec.

See Also:
Serialized Form

Constructor Summary
JdbcConnectionFactory(javax.resource.spi.ManagedConnectionFactory managedConnectionFactory, javax.resource.spi.ConnectionManager connectionManager, java.lang.String jdbcUrl, java.lang.String jdbcDriver, java.lang.String defaultPassword, java.lang.String defaultUserName)
           
 
Method Summary
 java.sql.Connection getConnection()
           
protected  java.sql.Connection getConnection(JdbcConnectionRequestInfo connectionRequestInfo)
           
 java.sql.Connection getConnection(java.lang.String username, java.lang.String password)
           
 int getLoginTimeout()
           
 java.io.PrintWriter getLogWriter()
           
 javax.naming.Reference getReference()
          getReference is called by JNDI provider during Context.bind
 void setLoginTimeout(int seconds)
           
 void setLogWriter(java.io.PrintWriter out)
           
 void setReference(javax.naming.Reference jndiReference)
          setReference is called by deployment code
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JdbcConnectionFactory

public JdbcConnectionFactory(javax.resource.spi.ManagedConnectionFactory managedConnectionFactory,
                             javax.resource.spi.ConnectionManager connectionManager,
                             java.lang.String jdbcUrl,
                             java.lang.String jdbcDriver,
                             java.lang.String defaultPassword,
                             java.lang.String defaultUserName)
                      throws javax.resource.ResourceException
Throws:
javax.resource.ResourceException
Method Detail

setReference

public void setReference(javax.naming.Reference jndiReference)
setReference is called by deployment code

Parameters:
jndiReference -

getReference

public javax.naming.Reference getReference()
getReference is called by JNDI provider during Context.bind

Specified by:
getReference in interface javax.naming.Referenceable
Returns:

getConnection

public java.sql.Connection getConnection()
                                  throws java.sql.SQLException
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
Specified by:
getConnection in interface javax.sql.DataSource
Throws:
java.sql.SQLException

getConnection

protected java.sql.Connection getConnection(JdbcConnectionRequestInfo connectionRequestInfo)
                                     throws java.sql.SQLException
Throws:
java.sql.SQLException

getLoginTimeout

public int getLoginTimeout()
Specified by:
getLoginTimeout in interface javax.sql.DataSource

getLogWriter

public java.io.PrintWriter getLogWriter()
Specified by:
getLogWriter in interface javax.sql.DataSource

setLoginTimeout

public void setLoginTimeout(int seconds)
Specified by:
setLoginTimeout in interface javax.sql.DataSource

setLogWriter

public void setLogWriter(java.io.PrintWriter out)
Specified by:
setLogWriter in interface javax.sql.DataSource


Copyright © 1999-2011 OpenEJB. All Rights Reserved.