net.spy.db
Class JNDIConnectionSource

java.lang.Object
  extended by net.spy.SpyObject
      extended by net.spy.db.JNDIConnectionSource
All Implemented Interfaces:
ConnectionSource

public class JNDIConnectionSource
extends SpyObject
implements ConnectionSource

Connection source for getting DB connections from JNDI sources.


Constructor Summary
JNDIConnectionSource()
          Get an instance of JNDIConnectionSource.
 
Method Summary
 java.sql.Connection getConnection(SpyConfig conf)
          This will get a connection to the JNDI resource.
 void returnConnection(java.sql.Connection conn)
          Return a connection.
 
Methods inherited from class net.spy.SpyObject
getLogger
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JNDIConnectionSource

public JNDIConnectionSource()
Get an instance of JNDIConnectionSource.

Method Detail

getConnection

public java.sql.Connection getConnection(SpyConfig conf)
                                  throws java.sql.SQLException
This will get a connection to the JNDI resource. The following parameters are required:
    • dbSource - the JNDI resource containing the connection Additional parameters will be passed to InitialContext after being converted to a Hashtable object. Note: It will not be cast to Hashtable, but instead a new Hashtable instance will be created with those parameters. This allows you to get connections from a JNDI context that doesn't know about SpyConfig.

      Specified by:
      getConnection in interface ConnectionSource
      Parameters:
      conf - The configuration to use for getting the database source
      Returns:
      A connection to the JNDI datasource
      Throws:
      java.sql.SQLException
      See Also:
      ConnectionSource

  • returnConnection

    public void returnConnection(java.sql.Connection conn)
    Description copied from interface: ConnectionSource
    Return a connection. This method is used to inform whatever pooling mechanism is in use that the connection is no longer wanted, or needed, or even cared about here.

    Specified by:
    returnConnection in interface ConnectionSource
    See Also:
    ConnectionSource


    Copyright © 1995-2006 SPY Internetworking. All Rights Reserved.