com.ibm.ims.rds
Class ClientDataSource

java.lang.Object
  |
  +--com.ibm.ims.rds.ClientDataSource
All Implemented Interfaces:
javax.sql.DataSource, javax.naming.Referenceable, java.io.Serializable

public class ClientDataSource
extends java.lang.Object
implements javax.sql.DataSource, java.io.Serializable, javax.naming.Referenceable

A IMSJdbcDataSource provides a mechanism to create a Connection from an object stored in the JNDI namespace. The DataSource object is either deployed into the name space by a deployment tool, such as that for WebSphere Application Server, or it can be deployed by an application different from the application using the DataSource. IMSJdbcDataSource can also be created directly in an application, rather than loading it from the name space. The following code snippet demonstrates how to create an IMS DataSource from an IMSJdbcManagedConnectionFactory and use it to create a Connection:

 IMSJdbcManagedConnectionFactory mcf = new IMSJdbcManagedConnectionFactory();
 mcf.setDatabaseViewName("MyDatabaseView");
 mcf.setDRAName("IMS1");
 DataSource dataSource = (DataSource)mcf.createConnectionFactory();
 Connection connection = dataSource.getConnection();
 
IMSJdbcDataSource implements both the Serializable and Referenceable interfaces, although the Referenceable interface is currently only supported in a managed-server environment.

See Also:
IMSJdbcManagedConnectionFactory, Connection, ManagedConnectionFactory, ConnectionManager, Reference, Referenceable, Serialized Form

Constructor Summary
ClientDataSource()
           
ClientDataSource(javax.resource.spi.ConnectionManager connectionManager, ClientManagedConnectionFactory managedConnectionFactory)
           
 
Method Summary
 java.sql.Connection getConnection()
          Gets a connection from the application server on behalf of the client.
 java.sql.Connection getConnection(java.lang.String userid, java.lang.String password)
          This function is not supported
 java.lang.String getDatabaseViewName()
          Returns the name of the DLIDatabaseView used by this DataSource object.
 java.lang.String getDRAName()
          Returns the DRA name of the IMS system this datasource is using.
 java.lang.String getHostName()
          Returns the name (or IP address) of the host machine.
 int getLoginTimeout()
          This function is not supported
 java.io.PrintWriter getLogWriter()
          Gets the PrintWriter contained in the associated IMSJdbcManagedConnectionFactory if one exists.
 java.lang.Integer getPortNumber()
          Returns the IIOP port number of the host machine's web server.
 javax.naming.Reference getReference()
          Returns stored reference.
 void setDatabaseViewName(java.lang.String databaseViewName)
          Sets the fully-qualified name of the DLIDatabaseView to be used by this DataSource object.
 void setDRAName(java.lang.String draName)
          Sets the DRA name of the IMS system for this datasource
 void setHostName(java.lang.String hostName)
          Sets the name of the of the host machine.
 void setLoginTimeout(int timeout)
          This method is not currently supported.
 void setLogWriter(java.io.PrintWriter printWriter)
          This method is not currently supported as tracing is enabled at the ManagedConnectionFactory level and filtered down to the DataSource.
 void setPortNumber(java.lang.Integer portNumber)
          Sets the IIOP port number of the of the host machine's web server.
 void setReference(javax.naming.Reference reference)
          Stores a reference.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ClientDataSource

public ClientDataSource()

ClientDataSource

public ClientDataSource(javax.resource.spi.ConnectionManager connectionManager,
                        ClientManagedConnectionFactory managedConnectionFactory)
Method Detail

getConnection

public final java.sql.Connection getConnection()
                                        throws java.sql.SQLException
Gets a connection from the application server on behalf of the client.
Specified by:
getConnection in interface javax.sql.DataSource
Returns:
a Connection object.
Throws:
java.sql.Exception - an SQLException that was thrown from the resource adapter's attempt to get a connection.
See Also:
Connection

getConnection

public final java.sql.Connection getConnection(java.lang.String userid,
                                               java.lang.String password)
                                        throws java.sql.SQLException
This function is not supported
Specified by:
getConnection in interface javax.sql.DataSource
Parameters:
userid - not used.
password - not used.
Returns:
not supported.
Throws:
java.sql.SQLException - a java.sql.SQLException indicating the method is not supported.
See Also:
Connection

getDatabaseViewName

public java.lang.String getDatabaseViewName()
Returns the name of the DLIDatabaseView used by this DataSource object.

setDatabaseViewName

public void setDatabaseViewName(java.lang.String databaseViewName)
Sets the fully-qualified name of the DLIDatabaseView to be used by this DataSource object.
Parameters:
databaseViewName - the fully-qualified DLIDatabaseView subclass

getDRAName

public java.lang.String getDRAName()
Returns the DRA name of the IMS system this datasource is using.

setDRAName

public void setDRAName(java.lang.String draName)
Sets the DRA name of the IMS system for this datasource
Parameters:
draName - the 4 character DRA ID

getHostName

public java.lang.String getHostName()
Returns the name (or IP address) of the host machine.
Returns:
the name of the host machine

setHostName

public void setHostName(java.lang.String hostName)
Sets the name of the of the host machine.
Parameters:
hostName - the name (or IP address) of the host machine.

getPortNumber

public java.lang.Integer getPortNumber()
Returns the IIOP port number of the host machine's web server.
Returns:
the port number of the host machine

setPortNumber

public void setPortNumber(java.lang.Integer portNumber)
Sets the IIOP port number of the of the host machine's web server.
Parameters:
portNumber - the port number of the host machine.

setReference

public void setReference(javax.naming.Reference reference)
Stores a reference.
Parameters:
reference - the JNDI Reference to be stored.
See Also:
Reference

getReference

public javax.naming.Reference getReference()
Returns stored reference.
Specified by:
getReference in interface javax.naming.Referenceable
Returns:
the JNDI Reference.
See Also:
Reference

getLogWriter

public final java.io.PrintWriter getLogWriter()
                                       throws java.sql.SQLException
Gets the PrintWriter contained in the associated IMSJdbcManagedConnectionFactory if one exists.
Specified by:
getLogWriter in interface javax.sql.DataSource
Returns:
a java.io.PrintWriter to the client.
Throws:
java.sql.SQLException - an SQLException that was thrown from the resource adapter's attempt to retrieve the PrintWriter.
See Also:
ManagedConnectionFactory.getLogWriter(), PrintWriter

getLoginTimeout

public final int getLoginTimeout()
                          throws java.sql.SQLException
This function is not supported
Specified by:
getLoginTimeout in interface javax.sql.DataSource
Throws:
java.sql.SQLException - Throws an SQLException indicating the method is not supported.

setLogWriter

public final void setLogWriter(java.io.PrintWriter printWriter)
                        throws java.sql.SQLException
This method is not currently supported as tracing is enabled at the ManagedConnectionFactory level and filtered down to the DataSource. Once at the DataSource level the output location cannot be changed.
Specified by:
setLogWriter in interface javax.sql.DataSource
Throws:
java.sql.SQLException - an SQLException indicating the method is not supported.

setLoginTimeout

public final void setLoginTimeout(int timeout)
                           throws java.sql.SQLException
This method is not currently supported.
Specified by:
setLoginTimeout in interface javax.sql.DataSource
Parameters:
timeout - not used.
Throws:
java.sql.SQLException - an SQLException indicating the method is not supported.


(C) International Business Machines Corporation 2004. All rights reserved.