Enterprise Information Portal APIs

com.ibm.mm.sdk.server
Class DKPoolJDBC

java.lang.Object
  |
  +--com.ibm.mm.sdk.server.DKPoolJDBC
All Implemented Interfaces:
DKConstant, DKMessageId, dkPool, java.io.Serializable

public class DKPoolJDBC
extends java.lang.Object
implements dkPool, DKConstant, DKMessageId, java.io.Serializable

DKPoolJDBC: A DKPoolJDBC object will manage the JDBC url Connections pool. It has two internal pools, one is for the unused connections and the other one is for the used connections. With getConnection, it will find a matched connection based on the passed userid & password from the free_pool and return the Connection to user. If no match found, it will create a new one.

See Also:
Serialized Form

Fields inherited from interface com.ibm.mm.sdk.common.DKConstant
    For details, see the class or interface
 
Fields inherited from interface com.ibm.mm.sdk.common.DKMessageId
    For details, see the class or interface
 
Constructor Summary
DKPoolJDBC()
          Constructs the database connection pool
 
Method Summary
 void destroy()
          Destroy this pool object including all connections in both free pool and used pool
 java.lang.String getConfigurationString()
          Gets the configuration string which supplies the specific initialization parameters for connection.
 DKHandle getConnection(java.lang.String userId, java.lang.String passwd)
          Gets a connection from the pool If no matched userid and password, it will create new one based on the passed userid-passwd
 int getConnTimeOut()
          Gets the number of seconds that an application waits for a connection from the pool before time out and throwing exception.
 int getIdleTimeOut()
          Gets the number of seconds that a connection should remain unused in the pool.
 int getMaxPoolSize()
          Gets the maximum number of connections that the pool should contain.
 int getMinPoolSize()
          Gets the minimum number of connections that the pool should keep when all the connections are idle.
 int getOrphanTimeOut()
          Gets the number of seconds that an application is allowed to hold an inactive connection.
 java.lang.String getServerName()
          Gets the name of the data source's server name.
 void initConnections(java.lang.String userId, java.lang.String passwd, int initSize)
          Initialize number of connections and store them in the pool
 java.lang.String poolConnectType()
          Gets the pool connect type for this connection pool For ICM in java, this will be JDBC
 void returnConnection(DKHandle handle)
          Returns a connection to the pool
 void setConfigurationString(java.lang.String configString)
          Sets the configuration string which supplies the specific initialization parameters for connection.
 void setConnTimeOut(int connTime)
          Sets the number of seconds that an application waits for a connection from the pool before time out and throwing exception.
 void setIdleTimeOut(int idleTime)
          Sets the number of seconds that a connection should remain unused in the pool before the connection is disconnect & destroyed.
 void setMaxPoolSize(int poolSize)
          Sets the maximum number of connections that the pool should contain.
 void setMinPoolSize(int poolSize)
          Sets the minimum number of connections that the pool should keep when all connections are idle.
 void setOrphanTimeOut(int orphanTime)
          Sets the number of seconds that an application is allowed to hold an inactive connection.
 void setServerName(java.lang.String aDSName)
          Sets the name of the data source's server name.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DKPoolJDBC

public DKPoolJDBC()
Constructs the database connection pool
Method Detail

getServerName

public java.lang.String getServerName()
Gets the name of the data source's server name. For JDBC, this is the jdbc url
Specified by:
getServerName in interface dkPool
Returns:
the data source server name

setServerName

public void setServerName(java.lang.String aDSName)
                   throws DKException,
                          java.lang.Exception
Sets the name of the data source's server name. For JDBC, this is the url. Once the connection has been created, you can not set this to a different name
Specified by:
setServerName in interface dkPool
Parameters:
aDSName - the url name for creating connection

getConfigurationString

public java.lang.String getConfigurationString()
Gets the configuration string which supplies the specific initialization parameters for connection. For JDBC, this is the driver name. Example of JDBC driver name are:

Specified by:
getConfigurationString in interface dkPool
Returns:
the configuration information

setConfigurationString

public void setConfigurationString(java.lang.String configString)
                            throws DKException,
                                   java.lang.Exception
Sets the configuration string which supplies the specific initialization parameters for connection. For JDBC, this is the driver name. Example of JDBC driver name are:

Once the connection has been created, you can not set this to a different configuration string

Specified by:
setConfigurationString in interface dkPool
Parameters:
configString - info about connection driver

getMaxPoolSize

public int getMaxPoolSize()
Gets the maximum number of connections that the pool should contain. 0(zero) indicates no maximum size (unlimited)
Specified by:
getMaxPoolSize in interface dkPool
Returns:
the maximum number of connection pool size

setMaxPoolSize

public void setMaxPoolSize(int poolSize)
                    throws DKException,
                           java.lang.Exception
Sets the maximum number of connections that the pool should contain. 0(zero) indicates no maximum size (unlimited). Once the connection has been created, you can not set this to a different number
Specified by:
setMaxPoolSize in interface dkPool
Parameters:
poolSize - the maximum number of connection pool size

getMinPoolSize

public int getMinPoolSize()
Gets the minimum number of connections that the pool should keep when all the connections are idle. 0(zero) indicates the connections should be created as needed.
Specified by:
getMinPoolSize in interface dkPool
Returns:
the minimum number of connection pool size

setMinPoolSize

public void setMinPoolSize(int poolSize)
                    throws DKException,
                           java.lang.Exception
Sets the minimum number of connections that the pool should keep when all connections are idle. 0(zero) indicates the connections should be created as needed. Once the connection has been created & connected, you can not set this to a different number
Specified by:
setMinPoolSize in interface dkPool
Parameters:
poolSize - the minimum number of connection pool size

getIdleTimeOut

public int getIdleTimeOut()
Gets the number of seconds that a connection should remain unused in the pool. After idle time out, the connection will be disconnected & destroyed. 0(zero) indicates no limit.
Specified by:
getIdleTimeOut in interface dkPool
Returns:
the number of seconds

setIdleTimeOut

public void setIdleTimeOut(int idleTime)
                    throws DKException,
                           java.lang.Exception
Sets the number of seconds that a connection should remain unused in the pool before the connection is disconnect & destroyed. 0(zero) indicates no limit.
Specified by:
setIdleTimeOut in interface dkPool
Parameters:
idleTime - the number of seconds

getConnTimeOut

public int getConnTimeOut()
Gets the number of seconds that an application waits for a connection from the pool before time out and throwing exception. 0(zero) indicates no wait.
Specified by:
getConnTimeOut in interface dkPool
Returns:
the number of seconds

setConnTimeOut

public void setConnTimeOut(int connTime)
                    throws DKException,
                           java.lang.Exception
Sets the number of seconds that an application waits for a connection from the pool before time out and throwing exception. 0(zero) indicates no wait.
Specified by:
setConnTimeOut in interface dkPool
Parameters:
connTime - the number of seconds (this is not implemented for WAS. Use WebSphere Adm. Console to configure this.

getOrphanTimeOut

public int getOrphanTimeOut()
Gets the number of seconds that an application is allowed to hold an inactive connection. 0(zero) indicates no inactive connection time out.
Specified by:
getOrphanTimeOut in interface dkPool
Returns:
the number of seconds

setOrphanTimeOut

public void setOrphanTimeOut(int orphanTime)
                      throws DKException,
                             java.lang.Exception
Sets the number of seconds that an application is allowed to hold an inactive connection. 0(zero) indicates no inactive connection time out.
Specified by:
setOrphanTimeOut in interface dkPool
Parameters:
orphanTime - the number of seconds (this is not implemented for WAS. Use WebSphere Adm. Console to configure this.

getConnection

public DKHandle getConnection(java.lang.String userId,
                              java.lang.String passwd)
                       throws DKException,
                              java.lang.Exception
Gets a connection from the pool If no matched userid and password, it will create new one based on the passed userid-passwd
Specified by:
getConnection in interface dkPool
Parameters:
userId - the user name used for connection
passwd - the password used for connection
Returns:
a DKHandle that contains the Connection object

to obtain the true Connection object call like: Connection con = (Connection)aDKHandle.handle();


returnConnection

public void returnConnection(DKHandle handle)
                      throws DKException,
                             java.lang.Exception
Returns a connection to the pool
Specified by:
returnConnection in interface dkPool
Parameters:
handle - a DKHandle that contains the Connection object

initConnections

public void initConnections(java.lang.String userId,
                            java.lang.String passwd,
                            int initSize)
                     throws DKException,
                            java.lang.Exception
Initialize number of connections and store them in the pool
Specified by:
initConnections in interface dkPool
Parameters:
userId - the user Id used for connection
passwd - the password used for connection
initSize - the number of connection to be created

destroy

public void destroy()
             throws DKException,
                    java.lang.Exception
Destroy this pool object including all connections in both free pool and used pool
Specified by:
destroy in interface dkPool

poolConnectType

public java.lang.String poolConnectType()
                                 throws java.lang.Exception
Gets the pool connect type for this connection pool For ICM in java, this will be JDBC
Specified by:
poolConnectType in interface dkPool
Returns:
pool connection type

EIP Java APIs

(c) Copyright International Business Machines Corporation 1996, 2002. IBM Corp. All rights reserved.