Test Connection Pooling

i have writen a DBTester.java to test connection pooling.
when i run my program , every time it open a new connection ?
please help me where i did mistake ?
package db;
import oracle.jdbc.pool.OracleConnectionPoolDataSource;
* @author Jayaraj
public class DBTester {
     private static void test() throws Exception {
          OracleConnectionPoolDataSource ocpds = new OracleConnectionPoolDataSource();
          ocpds.setURL("jdbc:oracle:thin:@127.0.0.1:1521:db1");
          ocpds.setUser("root");
          ocpds.setPassword("root");
          for (int i = 0; i < 100; i++) {
               new RequestThread(i, ocpds).start();
     public static void main(String[] args) throws Exception {
          test();
package db;
import java.sql.Connection;
import java.sql.SQLException;
import javax.sql.PooledConnection;
import oracle.jdbc.pool.OracleConnectionPoolDataSource;
* @author Jayaraj
public class RequestThread extends Thread implements Runnable {
     private OracleConnectionPoolDataSource datasource = null;
     private int rid = 0;
     public RequestThread(int rid, OracleConnectionPoolDataSource datasource) {
          this.datasource = datasource;
          this.rid = rid;     
     public void run() {
          try {               
               PooledConnection pc = datasource.getPooledConnection();
               Connection conn = pc.getConnection();
               System.out.println(" Request ID :" + rid + " Connection : " + conn);
               conn.close();
          } catch (SQLException e) {
               e.printStackTrace();
}

I have tested few properties . this will be helpfull
thanks for all ur reply
package db.test;
import java.sql.Connection;
import java.sql.SQLException;
import java.util.Properties;
import org.apache.commons.dbcp.DelegatingCallableStatement;
import oracle.jdbc.driver.OracleCallableStatement;
import oracle.jdbc.driver.OracleResultSet;
import oracle.jdbc.driver.OracleTypes;
import oracle.jdbc.pool.OracleConnectionCacheManager;
import oracle.jdbc.pool.OracleDataSource;
* @author Jayaraj
public class DBTester {
     public static void main(String[] args) throws Exception {
          OracleDataSource datasource = new OracleDataSource();
          datasource.setDataSourceName("oracle.jdbc.pool.OracleDataSource");
          datasource.setURL("jdbc:oracle:thin:@10.187.53.10:1521:TEST");
          datasource.setUser("wnr");
          datasource.setPassword("wnr");
          //enable the cache
          datasource.setConnectionCachingEnabled(true);
          Properties cacheProperties = new Properties();
          cacheProperties.setProperty("MinLimit", "2");                                                                      
          cacheProperties.setProperty("MaxLimit", "5");                                                                      
          cacheProperties.setProperty("InitialLimit", "3");
          //cacheProperties.setProperty("MaxStatementsLimit", "1");                                                                 
          cacheProperties.setProperty("InactivityTimeout", "10");
          //cacheProperties.setProperty("TimeToLiveTimeout", "");          
          cacheProperties.setProperty("AbandonedConnectionTimeout", "1");
          //cacheProperties.setProperty("ConnectionWaitTimeout", "");               
          //cacheProperties.setProperty("PropertyCheckInterval", "");
          //cacheProperties.setProperty("ValidateConnection", "");
          //cacheProperties.setProperty("ClosestConnectionMatch", "");
          //cacheProperties.setProperty("AttributeWeights", "");
          //cacheProperties.setProperty("LowerThresholdLimit", "");     
          datasource.setConnectionCacheProperties(cacheProperties);     
          System.out.println("testing initial limit");
          testInitialLimit(datasource);
          System.out.println("testing max limit");
          testMaxLimit(datasource);
     private static void testMaxLimit(OracleDataSource datasource) throws SQLException {
          String max = (String)datasource.getConnectionCacheProperties().get("MaxLimit");
          int maxi = Integer.parseInt(max);
          for (int i = 0; i < maxi ; i++) {
               //new TestThread(i,datasource).start();
               Connection conn =datasource.getConnection();
               System.out.println(i);
          System.out.println("waiting for existing to close....");
          Connection conn =datasource.getConnection();
          System.out.println("maximum connection reached.."+conn);
     static void showDetails() throws SQLException{
          OracleConnectionCacheManager sConnectionCacheMananger = OracleConnectionCacheManager.getConnectionCacheManagerInstance();
          String string[] = sConnectionCacheMananger.getCacheNameList();
          for (int i = 0; i < string.length; i++) {
               //System.out.println(string);
               System.out.println("AvailableConnections : "+sConnectionCacheMananger.getNumberOfAvailableConnections(string[i]));
               System.out.println("ActiveConnections : "+sConnectionCacheMananger.getNumberOfActiveConnections(string[i]));
     private static void testInitialLimit(OracleDataSource datasource ) throws SQLException {          
          Connection conn =datasource.getConnection();
          showDetails();     
          conn.close();

Similar Messages

  • Urgent please - Error Testing connection pool

    I have a connection pool and datasource working fine, but when I click at the testing hyperlink on the weblogic console/jdbc/testing, the following message apear at the Unix console.
    Caused by: javax.management.MalformedObjectNameException: bad object name,property Location has multiple values in Name=hom59DataSource,Type=ApplicationRuntime,Location=cbdHom,ServerRuntime=cbdHom,Loc
    ation=cbdHom,Type=JDBCDataSourceRuntime
    at java.lang.Throwable.<init>(Throwable.java:57)
    at java.lang.Throwable.<init>(Throwable.java:68)
    at weblogic.management.WebLogicObjectName.extractProperties(WebLogicObjectName.java:571)
    at weblogic.management.WebLogicObjectName.<init>(WebLogicObjectName.java:326)
    at weblogic.management.WebLogicObjectName.setParentFromObjectName(WebLogicObjectName.java:934)
    at weblogic.management.WebLogicObjectName.populate(WebLogicObjectName.java:851)
    at weblogic.management.WebLogicObjectName.<init>(WebLogicObjectName.java:328)
    at weblogic.management.WebLogicObjectName.<init>(WebLogicObjectName.java:822)
    at weblogic.management.jmx.MBeanServerInvocationHandler.getWebLogicObjectName(MBeanServerInvocationHandler.java:80)
    Somebody please could help me?
    Message was edited by:
    Denimar

    Have figured this out. Need to set the "Test Connections" settings under Configurations
    (Advanced Options) for the Connection Pool.
    Thanks for your help :)
    Joe Weinstein <[email protected]> wrote:
    Everbright wrote:
    Hi,
    I've just started working on the Avitek Tutorials.
    Encountered the following error message when testing the connectionpools for
    both the XA and non-XA connections.
    Warning! Connectivity to backend database not verified. This is eitherbecause
    required connection pool attributes "TestConnectionsOnReserve" or "TestConnectionsOnRelease"
    have not been enabled, or an invalid value has been specified for attribute"TestTableName".
    Please check the server log for more details..
    Any ideas what might be wrong?It is likely that some part of the information you specified about how
    to connect to
    your database was incorrect, so weblogic was unable to make a pool of
    connections.
    We will know more if you show us the server log file, which will contain
    messages
    about any errors it suffered during startup...
    Joe
    Thanks!

  • Error testing connection pools

    Hi,
    I've just started working on the Avitek Tutorials.
    Encountered the following error message when testing the connection pools for
    both the XA and non-XA connections.
    Warning! Connectivity to backend database not verified. This is either because
    required connection pool attributes "TestConnectionsOnReserve" or "TestConnectionsOnRelease"
    have not been enabled, or an invalid value has been specified for attribute "TestTableName".
    Please check the server log for more details..
    Any ideas what might be wrong?
    Thanks!

    Have figured this out. Need to set the "Test Connections" settings under Configurations
    (Advanced Options) for the Connection Pool.
    Thanks for your help :)
    Joe Weinstein <[email protected]> wrote:
    Everbright wrote:
    Hi,
    I've just started working on the Avitek Tutorials.
    Encountered the following error message when testing the connectionpools for
    both the XA and non-XA connections.
    Warning! Connectivity to backend database not verified. This is eitherbecause
    required connection pool attributes "TestConnectionsOnReserve" or "TestConnectionsOnRelease"
    have not been enabled, or an invalid value has been specified for attribute"TestTableName".
    Please check the server log for more details..
    Any ideas what might be wrong?It is likely that some part of the information you specified about how
    to connect to
    your database was incorrect, so weblogic was unable to make a pool of
    connections.
    We will know more if you show us the server log file, which will contain
    messages
    about any errors it suffered during startup...
    Joe
    Thanks!

  • Testing connection with Oracle thin driver

    Hi !
    I am testing Oracle connection from dos prompt and I get the SQL Error SQLEXCEPTION.
    How do I connect Petstore to Oracle database? When I test the connection I get error message that java.sql.SQLException No License: weblogic.comon.LicenseNotFoundException. The file is in weblogic home directory.

    Hi Sree !
    Thanks !
    After I ran the SetEnv.cmd, this is working and I guess I am ok now to use this
    connection pool.
    Thank you very much.
    .Madhuri
    "Sree Bodapati" <[email protected]> wrote:
    can you point me to the doc which talks about the valid DBTYPE values
    (url)?
    java utils.dbping ORACLE_THIN scott tiger
    <machineip_or_name>:1521:<tns_alias >
    this should work fine. for out of box usage, just goto the the folder
    <wl_home>/config/mydomain and execute setenv.cmd / setenv.sh then execute
    the above command from the same shell.
    This command is not testing connection pool. its making sure that you
    can
    connect to the db and it will not take you into sqlplus, it will show
    you
    multiple ways to code your connections to the database.
    sree
    "Madhuri" <[email protected]> wrote in message
    news:[email protected]...
    Hi Sree !
    Thanks for your prompt reply. I have tried your solution but stillI am
    having
    problem and I don't find more info. about this on Bea site. Pleasesee
    following
    E:\bea\wlserver6.1>java utils.dbping ORACLE_THIN <username> <password>host:port:database
    name
    Valid DBTYPE values:
    ORACLE, ORACLE_JDBC20, INFORMIX4, [JCONNECT | SYBASE], MSSQLSERVER4
    Where I should have to use dbtype, is there something missing in command?
    Please let me know.
    After the connection pool test is successful, it should take me toSQLPLUS, am
    I right? What message I should be expecting?
    Thanks
    ..Madhuri
    "Sree Bodapati" <[email protected]> wrote:
    The license file for WLS6.1 is license.bea file that is normally in
    the
    BEA_HOME folder.
    Usage for utils.dbping:
    Usage: java utils.dbping ORACLE USER PASS DBNAME
    or java utils.dbping ORACLE_THIN USER PASS HOST:PORT:DBNAME
    or java utils.dbping JCONNECT USER PASS HOST:PORT/DBNAME
    or java utils.dbping INFORMIX4 USER PASS DBNAME@HOST:PORT
    or java utils.dbping MSSQLSERVER4 USER PASS DBNAME@HOST:PORT
    Try to use the second one and it should work. What you were usingwas
    the
    dbping for OCI driver.
    sree
    "Madhuri" <[email protected]> wrote in message
    news:[email protected]...
    Hi Sree !
    I tried this but still I get an error. Please see the following
    E:\bea\wlserver6.1>java -classpath%WL_HOME%;%WL_HOME%\license;%CLASSPATH%
    utils
    dbping ORACLE <username> <password> <database>
    Missing license file for: WebLogic Server 6.1
    Error encountered:
    java.sql.SQLException: Fail to load jDriver/Oracle due to license
    checking
    faile
    d!
    at
    weblogic.jdbc.oci.Driver.loadLibraryIfNeeded(Driver.java:182)
    at weblogic.jdbc.oci.Driver.connect(Driver.java:76)
    at java.sql.DriverManager.getConnection(DriverManager.java:517)
    at java.sql.DriverManager.getConnection(DriverManager.java:146)
    at utils.dbping.main(dbping.java:167)
    Hi why it is complaining for OCI drivers when I am using thin driver?
    Thanks
    ..Madhuri
    "Sree Bodapati" <[email protected]> wrote:
    Try,
    java -classpath %WL_HOME%;%WL_HOME%\license;%CLASSPATH% utils.dbping
    ORACLE
    scott tiger TNS_alias
    and see if it helps, make sure WL_HOMe is set properly.
    sree
    "Madhuri" <[email protected]> wrote in message
    news:[email protected]...
    Hi Sree !
    Following is the error message I am getting:
    java.sql.SQLException: No License:weblogic.common.LicenseNotFoundException:
    weblogic.common.LicenseNotFoundException:
    Could not find licensing file:
    Your WebLogic license file, named either WebLogicLicense.xmlor
    WebLogicLicense.class must be located in a directory
    that
    is
    in your CLASSPATH. By default, your license file is locatedin the
    /license directory located in your WebLogic home directory
    (the root directory of your WebLogic installation).
    As of version 4.0 of WebLogic, a new XML-format license
    file
    has
    replaced the older, compiled class format license file.
    The WebLogic Server will recognize either format.
    For additional information on WebLogic licenses or on
    setting
    your
    class
    path, see the installation instructions in the WebLogic Serverdocumentation,
    av
    ailable at
    http://e-docs.bea.com/
    at weblogic.jdbcbase.oci.Driver.connect(Driver.java:72)
    at java.sql.DriverManager.getConnection(Unknown Source)
    at java.sql.DriverManager.getConnection(Unknown Source)
    at utils.dbping.main(dbping.java:156)
    One more thing I would like to tell you that the file (including
    class
    file) is
    in the weblogic directory and the folder is also in the classpath.I am
    trying
    the following command :
    java utils.dbping ORACLE scott tiger TNS_alias
    Thanks in advance.
    .Madhuri
    "Sree Bodapati" <[email protected]> wrote:
    Hi Madhuri,
    Try placing the folder in which you have the license file in
    your
    classpath.
    Can you post the SQL Exception?
    sree
    "Madhuri" <[email protected]> wrote in message
    news:[email protected]...
    Hi !
    I am testing Oracle connection from dos prompt and I get the
    SQL
    Error
    SQLEXCEPTION.
    How do I connect Petstore to Oracle database? When I test
    the
    connection
    I
    get error message that java.sql.SQLException No License:
    weblogic.comon.LicenseNotFoundException. The file is in weblogic
    home
    directory.

  • How to test if connection pool is set up correctly in WL 7 SP 7

    Hi all,
    2 questions.
    1) how do i test if the connection pool i set is working? in the testing tab of the jdbc connection pool in the console page, there is a Test Table Name, i entered 'dual' in the text field. After i clicked apply, there is no indication if i set it up correctly.
    2)After i configure the connection pool, do i need to configure the data sources?

    Could you please try using a "Test_When" statement?
    Karthik

  • Connection pool / db failure

    WLS6.0 sp2 / Win2k
    Oracle 8.1.7 / Solaris 8
    problem is if DB fails, the connection pool fails, and will not restart. If I run a java weblogic.Admin EXISTS_POOL command, it says the pool doesnt exist.
    If i run a RESET_POOL, using the system user password, it comes back with:
    Exception in thread "main" javax.naming.AuthenticationException. Root exception is java.lang.Securi
    tyException: Authentication for user guest denied in realm weblogic
    <<no stack trace available>>
    I have test on reserved set (and dual as the table).
    Anyone shed any light on what could be going wrong, because right now, every time the DB fails, we have to restart the **&$"&^ server.... (and that takes around 20mins for all the apps to init)
    tks
    will

    Hi Will,
    When you bring up the server, if the database is down, your connection pools
    will not come up if you have an initial capacity greater than 0. This is a
    known issue and the workaround for this is to set the initial capacity to
    zero so the pool comes up even when the database is down, then make sure you
    set the capacity increment to the value that you like your initial capacity
    to be and have the TestConnectionOnReserve to true.
    hth
    sree
    "Will" <[email protected]> wrote in message
    news:3d13111f$[email protected]..
    WLS6.0 sp2 / Win2k
    Oracle 8.1.7 / Solaris 8
    problem is if DB fails, the connection pool fails, and will not restart.If I run a java weblogic.Admin EXISTS_POOL command, it says the pool doesnt
    exist.
    If i run a RESET_POOL, using the system user password, it comes back with:
    Exception in thread "main" javax.naming.AuthenticationException. Rootexception is java.lang.Securi
    tyException: Authentication for user guest denied in realm weblogic
    <<no stack trace available>>
    I have test on reserved set (and dual as the table).
    Anyone shed any light on what could be going wrong, because right now,every time the DB fails, we have to restart the **&$"&^ server.... (and that
    takes around 20mins for all the apps to init)
    >
    tks
    will

  • Issue JDBC connection pool with Glassfish 3.1.2.2 and Oracle XE 11gR2

    Hello,
    I am experiencing an issue with pinging a JDBC connection Pool.
    I installed the following without any warnings or errors:
    Operating System: Oracle Enterprise Linux 5
    Oracle XE 11gR2 (11.2.0.2.0) database
    Glassfish 3.1.2.2
    I will refer to the steps I did after the installations
    1) In the .profile file of the OS I add the following:
    JRE_HOME=/usr/java/jre1.6.0_31; export JRE_HOME
    JAVA_HOME=/usr/java/jdk1.6.0_31; export JAVA_HOME
    GLASSFISH_DIR=/u01/glassfish3
    GLASSFISH_HOME=/u01/glassfish3/glassfish
    DERBY_HOME=$GLASSFISH_DIR/javadb
    OPEN_MQ_HOME=$GLASSFISH_DIR/mq
    PATH=:$JAVA_HOME/bin:$JRE_HOME/bin:$PATH:$HOME/bin:$GLASSFISH_HOME/bin:$DERBY_HOME/bin:$OPEN_MQ_HOME/bin
    export GLASSFISH_HOME
    export DERBY_HOME
    export OPEN_MQ_HOME
    export PATH
    LD_LIBRARY_PATH=/u01/app/oracle/product/11.2.0/xe/lib; export LD_LIBRARY_PATH
    . /u01/app/oracle/product/11.2.0/xe/bin/oracle_env.sh
    2) I copied the ojdbc6.jar to the $GLASSFISH_HOME/domains/domain1/lib
    3) I login to the Glassfish admin console and created a new JDBC Connection Pool.
    Pool Name: ds_orasys
    Resource Type: javax.sql.DataSource
    Datasource Classname: oracle.jdbc.pool.OracleDataSource
    User: [myschema]
    Password: [myschema password]
    URL: jdbc:oracle:thin:@localhost:1521:xe
    When I ping the connection pool I get the following message in the server log:
    [#|2012-10-23T12:14:37.069+0300|WARNING|glassfish3.1.2|javax.enterprise.resource.resourceadapter.com.sun.enterprise.connectors.service|_ThreadID=22;_ThreadName=Thread-2;|RAR8054: Exception while creating an unpooled [test] connection for pool [ ds_orasys ], Connection could not be allocated because: Invalid Oracle URL specified|#]
    [#|2012-10-23T12:14:37.071+0300|SEVERE|glassfish3.1.2|org.glassfish.admingui|_ThreadID=19;_ThreadName=Thread-2;|RestResponse.getResponse() gives FAILURE. endpoint = 'http://212.205.62.217:4848/management/domain/resources/ping-connection-pool.json'; attrs = '{id=ds_orasys}'|#]
    I tried to use different jar files. I used ojdbc6dms.jar and ojdbc14.jar.
    I also copied the jar files in the $GLASSFISH_HOME/domains/domain1/lib/ext directory as some people suggested. Still no luck. I keep getting the same error messages in the server.log
    Can anybody help me out or point me to the right direction.
    Thank you in advance

    The error is in the URL. It was in front of my eyes and I couldn't see the error. I skipped the ':' before the '@' when I created the pool. It is working fine now.

  • JDBC Connection pool recovery after DB server restart

    I am finding that Kodo is throwing the following exception after I restart
    my database server (mysql). I am doing the database server restart while my
    application server is idle, so it is not during a transaction.
    Communication link failure: java.net.SocketException [code=0;state=08S01]
    NestedThrowables:
    com.solarmetric.kodo.impl.jdbc.sql.SQLExceptionWrapper:
    This is presumably due to the JDBC connection pooling. Is there a
    configuration setting that allows Kodo to detect such failures and reconnect
    to the database server without exposing this problem to the application
    code? For example, WebLogic Server's JDBC connection pool has a setting that
    enables testing a connection and recovering from such failures before
    allocating it from the pool.
    Ben

    This is presumably due to the JDBC connection pooling. Is there a
    configuration setting that allows Kodo to detect such failures and reconnect
    to the database server without exposing this problem to the application
    code?Not right now. You can log an enhancement request with our bug database:
    http://bugzilla.solarmetric.com/

  • RCA Connection Pool idle Time-Out takes no effect !

    My question description goes here.
    According to JCA specification, I developed my 'ManagedConnectionImpl' class from the interface 'ManagedConnection'. I realize the 'destroy()' function to send out logout request to the EIS.
    Then I deployed the connector in Sun Java System Application Server, I noticed there are two parameters in Connection Pool part, they are:
    1. Idle Timeout. It said it's the maximum time that a connection can remain idle in the pool. I assume the connection will be removed after the specific time expired and before it's removed it will call the recallable function, 'destroy()', in my concrete class, 'ManagedConnectionImpl'.
    2. Pool Resize Quantity. it said it's number of connections to be removed when pool idle time expired.
    I am weird about it. I think EIS had itself session control strategy, if the specific session time-out expired, it will invalidate this session. So I think we will set 'Idle Timeout' in application server to be shorter than the EIS session time-out. If the 'Idle Timeout' in application server expired, it should remove all connections inside otherwise maybe the connection with invalid session will exist! (the background knowledge is our system will return back soap fault when it meets invalid session, so the invalid connections will not be removed by switching on your configuration item, 'On Any Failure')
    So I set "inital and minimum pool size" to 8, "maximum pool size" to 32 and "Pool Resize Quantity" to 32. (I expect AS to remove all when pool idle time expired)
    After deploying, I send out requests at the first round and wait for the time expired but I can't see the desired logout requests from pool automatically even one. Firstly I guess if my recallable function definition is wrong but when I shut down the Application Server, the desired logout requests are sent out from pool automatically. So I think my recallable function definition is workable.
    What's your comments on it?
    P.S.
    I am using Sun Java System Application Server 8.1.
    Thanks in advance!
    BRs
    /Leo

    I have had following test to ensure I sent out notification to listener.
    [#|2005-08-23T16:14:25.061+0800|INFO|sun-appserver-pe8.1_01|javax.enterprise.system.stream.out|_ThreadID=12;|
    It's in managed env!|#]
    [#|2005-08-23T16:14:25.062+0800|INFO|sun-appserver-pe8.1_01|javax.enterprise.system.stream.out|_ThreadID=12;|
    enter matchManagedConnections() !|#]
    [#|2005-08-23T16:14:25.062+0800|INFO|sun-appserver-pe8.1_01|javax.enterprise.system.stream.out|_ThreadID=12;|
    try to find a matching and existing one, reuse it!|#]
    [#|2005-08-23T16:14:25.062+0800|INFO|sun-appserver-pe8.1_01|javax.enterprise.system.stream.out|_ThreadID=12;|
    Found a matching and existing one, reuse it!|#]
    [#|2005-08-23T16:14:25.495+0800|INFO|sun-appserver-pe8.1_01|javax.enterprise.system.stream.out|_ThreadID=12;|
    tearDown() is called, the application-level connection is released!|#]
    [#|2005-08-23T16:14:25.496+0800|INFO|sun-appserver-pe8.1_01|javax.enterprise.system.stream.out|_ThreadID=12;|
    enter calling close() of managed connection.|#]
    [#|2005-08-23T16:14:25.496+0800|INFO|sun-appserver-pe8.1_01|javax.enterprise.system.stream.out|_ThreadID=12;|
    Start calling close() of managed connection.|#]
    [#|2005-08-23T16:14:25.496+0800|INFO|sun-appserver-pe8.1_01|javax.enterprise.system.stream.out|_ThreadID=12;|
    start to notify the listener the completeness of connection.|#]
    [#|2005-08-23T16:14:25.496+0800|INFO|sun-appserver-pe8.1_01|javax.enterprise.system.stream.out|_ThreadID=12;|
    notify the listener the completeness of connection successfully.|#]
    Whether it's related with the initial and minimum number parameter? Although I found it will not be created during AS start-up and will be created at the first request.
    Whether it shall be kept to meet the minimum requirement? I have failed to set it to 0.

  • JDBC connection pool failures when used by JMS stores

              We are using WebLogic 6.1 sp2. We defined a separate connection pool for use by
              a JMS Store.
              <JDBCConnectionPool Name="sybaseJMSPool"
              Targets="cluster00"
              InitialCapacity="2"
              MaxCapacity="10"
              DriverName="com.sybase.jdbc2.jdbc.SybDriver"
              Properties="[email protected]@;[email protected]@;charset=utf8"
              URL="jdbc:sybase:Tds:@jms.db.host@/@jms.db.name@"/>
              (note that the @xxx@ string are replaced by actual values).
              We are using Sybase Jconnect 5.5 to a Sybase ASE 12.5 database.
              We deployed this configuration on a number of environments (testing, staging,
              ..). The actual hardware and network configuration is different for the different
              system, but the WebLogic domain stays the same regarding this issue.
              On the test system we frequently get the following exceptions:
              <Aug 13, 2002 1:56:04 PM CEST> <Alert> <JMS> <www00-test> <node00>
              <ExecuteThread: '6' for queue: 'JMS.TimerClientPool'> <> <> <040048>
              <JMSServer "JMSServer00", store failure while writing message for topic
              OrderChangeTopic, java.io.IOException: JMS JDBC store, connection pool =
              <sybaseJMSPool>, prefix = <JMS00>: write failed
              java.sql.SQLException: JZ006: Caught IOException:
              com.sybase.jdbc2.jdbc.SybConnectionDeadException: JZ0C0: Connection is already
              closed.
              at com.sybase.jdbc2.jdbc.ErrorMessage.raiseErrorCheckDead
              (ErrorMessage.java:715)
              at com.sybase.jdbc2.tds.Tds.handleIOE(Tds.java:3124)
              at com.sybase.jdbc2.tds.Tds.cancel(Tds.java:1412)
              at com.sybase.jdbc2.tds.Tds.cancel(Tds.java:1341)
              at com.sybase.jdbc2.jdbc.SybStatement.doCancel(SybStatement.java:564)
              at com.sybase.jdbc2.jdbc.SybStatement.updateLoop(SybStatement.java:1672)
              at com.sybase.jdbc2.jdbc.SybStatement.executeUpdate
              (SybStatement.java:1625)
              at com.sybase.jdbc2.jdbc.SybPreparedStatement.executeUpdate
              (SybPreparedStatement.java:91)
              at com.p6spy.engine.logging.P6LogPreparedStatement.executeUpdate
              (P6LogPreparedStatement.java:179)
              at weblogic.jdbc.pool.Statement.executeUpdate(Statement.java:293)
              at weblogic.jms.store.JDBCIOStream.write(JDBCIOStream.java:1246)
              at weblogic.jms.store.StoreRequest.doTheIO(StoreRequest.java:250)
              at weblogic.jms.store.JMSStore.execute(JMSStore.java:182)
              at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:139)
              at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
              .>
              java.io.IOException: JMS JDBC store, connection pool = <sybaseJMSPool>, prefix
              = <JMS00>: write failed
              java.sql.SQLException: JZ006: Caught IOException:
              com.sybase.jdbc2.jdbc.SybConnectionDeadException: JZ0C0: Connection is already
              closed.
              at com.sybase.jdbc2.jdbc.ErrorMessage.raiseErrorCheckDead
              (ErrorMessage.java:715)
              at com.sybase.jdbc2.tds.Tds.handleIOE(Tds.java:3124)
              at com.sybase.jdbc2.tds.Tds.cancel(Tds.java:1412)
              at com.sybase.jdbc2.tds.Tds.cancel(Tds.java:1341)
              at com.sybase.jdbc2.jdbc.SybStatement.doCancel(SybStatement.java:564)
              at com.sybase.jdbc2.jdbc.SybStatement.updateLoop(SybStatement.java:1672)
              at com.sybase.jdbc2.jdbc.SybStatement.executeUpdate
              (SybStatement.java:1625)
              at com.sybase.jdbc2.jdbc.SybPreparedStatement.executeUpdate
              (SybPreparedStatement.java:91)
              at com.p6spy.engine.logging.P6LogPreparedStatement.executeUpdate
              (P6LogPreparedStatement.java:179)
              at weblogic.jdbc.pool.Statement.executeUpdate(Statement.java:293)
              at weblogic.jms.store.JDBCIOStream.write(JDBCIOStream.java:1246)
              at weblogic.jms.store.StoreRequest.doTheIO(StoreRequest.java:250)
              at weblogic.jms.store.JMSStore.execute(JMSStore.java:182)
              at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:139)
              at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
              at weblogic.jms.store.JDBCIOStream.throwIOException
              (JDBCIOStream.java:1213)
              at weblogic.jms.store.JDBCIOStream.write(JDBCIOStream.java:1256)
              at weblogic.jms.store.StoreRequest.doTheIO(StoreRequest.java:250)
              at weblogic.jms.store.JMSStore.execute(JMSStore.java:182)
              at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:139)
              at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
              Before that this message appeared:
              <Aug 13, 2002 11:31:16 AM CEST> <Error> <ConnectionManager> <www00-test>
              <node00> <ExecuteThread: '26' for queue: 'default'> <> <> <000000>
              <Closing: 'weblogic.rjvm.t3.T3JVMConnection@795af6' because of: 'Server
              received a message over an uninitialized connection: 'JVMMessage from: 'null'
              to: '-4555218188801970213S:192.168.13.1:[7001,7001,7002,7002,7001,7002,-
              1]:ADIS:node00' cmd: 'CMD_REQUEST', QOS: '101', responseId: '1',
              invokableId: '287', flags: 'JVMIDs Not Sent, TX Context Not Sent', abbrev
              offset: '34'''>
              This problem did not occur on another system which was used during a 2 day stress
              testing session.
              It seems that the problem occurs after a period in which no user request where
              made. The user requests trigger EJB's that start sending JMS messages.
              When the problem occurs, the JMS messaging systems seems to lock up as no messages
              are received anymore by the different listeners (MDBs).
              Undeploying and redeploying the JBDC connection pool solves the problem. This
              solution is unacceptable in case of a production system.
              A similarly defined connection pool, which is used by the EJBs to make database
              connection, does not manifest this problem.
              <JDBCConnectionPool Name="sybasePool"
              Targets="cluster00"
              InitialCapacity="10"
              CapacityIncrement="5"
              MaxCapacity="50"
              PreparedStatementCacheSize="150"
              DriverName="com.sybase.jdbc2.jdbc.SybDriver"
              Properties="[email protected]@;[email protected]@;JCONNECT_VERSION=6;charset=utf8"
              URL="jdbc:sybase:Tds:@db.host@/@db.name@"/>
              The JDBC connection pool is used as follows by the JDBC store
              <JMSJDBCStore ConnectionPool="sybaseJMSPool" Name="JDBCStore00" PrefixName="JMS00"/>
              <JMSServer Name="JMSServer00" Store="JDBCStore00" Targets="node00">
              <JMSTopic JNDIName="ADIS.JMSError" JNDINameReplicated="false" Name="ErrorTopic"/>
              <JMSTopic JNDIName="ADIS.Status"
              Name="StatusTopic" RedeliveryDelayOverride="300000"/>
              <JMSTopic JNDIName="ADIS.OrderChange" JNDINameReplicated="false"
              Name="OrderChangeTopic" RedeliveryLimit="3"/>
              </JMSServer>
              Turning on the "Test Reserved Connection" with a appropriate test table does not
              help.
              Some sources on the internet tell us that JZ0C0 errors in the Jconnect driver
              can be related to network problems. Nevertheless the connection pool should be
              able to cope with this.
              Can you provide any solution for this ? Or give us hints what can cause the problem
              

    Zhenhao Qi wrote:
    thanks! Joe.
    The SQL statement itself can no longer be simplified, the long excuation time is due to the database size and complicated Select criteria. I can easily reproduce the problem by using this SQL. I tried "BEA's Oracle driver (Type 4): Version 8.1.7,9.0.1,9.2.0". the question can be dissect into 2 pieces:
    1) why the jdbc connection (using oracle.jdbc.OracleDriver) won't return anything if the SQL execution time > 5min, that is probably the Oracle's problem
    2) why the occupied connection pool won't release even I set "Statementtimeout=600", this is Weblogic's problem.
    ZhenhaoHi. Yes, (1) is oracle's problem. (2) may also be. The JDBC spec has very few
    allowances for one thread to interrupt a second thread's JDBC call. If we
    transmit your timeout request by calling setQueryTimeout() on the oracle
    statement, and if you have a weblogic-controlled transaction we call
    Statement.cancel() on any ongoing statement, we end up relying on whether
    the Oracle driver implements and responds to those calls.
    Are you doing weblogic-controlled transactions? Are you/can you
    call Statement.setQueryTimeout() on your statements, or are these
    generated JDBC queries?
    If you can duplicate the problem using the weblogic.jdbc.oracle.OracleDriver
    we have some other debug avenues. This would be good even if you really
    want to use the thin driver, because we will do the same JDBC calls to
    either driver, and the debug would prove (if) we set up a query timeout
    and if we call cancel(). If we do, then we can know that it is the Oracle
    driver failing in these regards.
    Joe

  • WL Connection Pool bad behaviour

    My WebLogic server is configurated with two connection pools towards an Oracle
    and a Sql db servers.
    Unfortunately, when a DB server goes down the WebLogic connection pool is not
    refreshed until I RE-START the WebLogic server.
    In particular, it seesms that a db failure causes WebLogic connection pool to
    have bad connections ("connection CLOSED", in jdbc log...) that are not good to
    execute Stored Procedures.
    Have anyone find this problem?
    Could someone recommend me a solution to face to this problem?
    Thank you very much in advance!
    Mauro

    Mauro,
    Could you post text of the exception and the source code where it happens?
    Slava
    Hi Slava,
    yes of course, I tried!
    With TestOnReserve/Release turned ON WebLogic understands that the poolconnections
    are "closed" and when I ask a connection the exception "No ResourcesAvailable"
    is thrown.
    On the contrary, with TestOnReserve turned OFF, WebLogic does not test thepool
    and grants the connection on demand, but the stored procedures (only thestored
    procedures!!??) executed on this connection throw the exception("connection closed").
    >
    I tried also to catch the failure and to refresh the connection poolthrough the
    weblogic.jdbc.JdbcServices (please see the attached file), but the reset()method
    has no effects...
    My configuration is WebLogic6.0 server with Service Pack 2 installed. Maybe that
    the JdbcServices are deprecated in this version.
    Thank you very much!
    Mauro
    "Slava Imeshev" <[email protected]> wrote:
    Hi Mauro,
    Have you turned TestOnReserve on?
    Regards,
    Slava Imeshev
    "Mauro De Santis" <[email protected]> wrote in message
    news:3b2e2557$[email protected]..
    My WebLogic server is configurated with two connection pools towardsan
    Oracle
    and a Sql db servers.
    Unfortunately, when a DB server goes down the WebLogic connection poolis
    not
    refreshed until I RE-START the WebLogic server.
    In particular, it seesms that a db failure causes WebLogic connectionpool
    to
    have bad connections ("connection CLOSED", in jdbc log...) that arenot
    good to
    execute Stored Procedures.
    Have anyone find this problem?
    Could someone recommend me a solution to face to this problem?
    Thank you very much in advance!
    Mauro

  • HELP - DB2 v9 & App Server PE 9.0 - PING Connection Pool Failure - HELP

    I've been playing around with Studio Creator and DB2 v9 without any issues.
    So I figured I would installed App Server PE 9 and use this as my production server that I would deploy to from studio creator.
    However, in my efforts to set up db2/v9 I have been trying to ping a connection pool without any luck. I get the following message:
    Operation 'pingConnectionPool' failed in 'resources' Config Mbean. Target exception message: Connection could not be allocated because: [sunm][DB2 JDBC Driver]Resource Limits Reached( ALLOCATE MEMORY FOR NEW SQLSTT FAILED ). Diagnostic Info: FUNCTION ID = 0049 , PROBE POINT = 0400 , TRACE POINT = 0030 , SUBCODE1 = 8B0F0000, SUBCODE2 = 78A68A98, SUBCODE3 = 00000000, ERROR MSG = Parser: Memory allocation error.
    My datasource class name is com.sun.sql.jdbcx.db2.DB2DataSource.
    And my resource type is javax.sql.datasource
    I have copied smbase.jar, smdb2.jar and smutil.jar into c:\sun\appserver\lib
    and I have all of the properties (serverName, portNumber, databaseName, user, password) created and set accordingly.
    Any help would be greatly appreciated.

    Here is how I got the DB2 Express-C and Sun PE 9.0 to work. ( at least base connectivity wise )
    1. ) You have to have at least the DB2 Client installed on the system that will be communicating to the DB2 instance.
    2.) The following jars will be needed ( depending on the driver type used) . db2java.zip, db2jcc.jar, and db2jcc_license_cu.jar and use them in the App Server ->JVM settings -> Path Settings -> Classpath Suffix
    3.) The next setup is dependent on the Type driver you use
    I used the Type 4 and this is the resource setup I used.
    Connection Pool:
    Name: DB2TestPool
    Datasource Classname: com.ibm.db2.jcc.DB2SimpleDataSource
    Resource Type: javax.sql.ConnectionPoolDataSource
    Properties:
    user: xxxxxx
    password: xxxxxx
    databaseName: TEST
    serverName: <hostname of machine>
    portnumber: 50000
    driverType: 4
    URL: jdbc:db2://<hostname>:<port>/<database>
    JDBC Resource:
    JNDI Name: jdbc/TEST
    Pool Name: DB2TestPool
    With this configuration I was able to ping the database as well as connect to create an entity bean from a table. This should give you a starting point.
    I have yet to deploy my application, but should be doing that sometime today to verify that a connection can be made and used from within the application.

  • Create and Apply new connection pool failure

    Hi all,
    I am trying to creat a new connection pool by the examples Console with WebServer
    6.0
    Name: testingPool
    URL: jdbc:cloudscape:demo or jdbc:dbc:cloudscape:Test (where Test is a new DB
    in cloudscape)
    Driver Name:COM.cloudscape.core.JDBCDriver
    Property:
    user=none
    password=none
    server=none
    Then create a Datasource which using the new created testingPool and the Target
    is the "exampleServer"
    However when I start the server,it keeps on complaining that the "testingPool
    is not exist".
    Any setting that I 've missed when using a new connection pool??
    I only know the workaround is using the demoPool which is already exist in the
    example.
    Any help will be very appreciate!!
    Thanks !
    Regards,
    u0p1

    HI,
    I've already set the Target Server to be the Example Server,
    is it wrong?
    "Sree Bodapati" <[email protected]> wrote:
    Check if you have set a target server for the connection pool.
    sree
    "u0p1" <[email protected]> wrote in message
    news:3bb3bc32$[email protected]..
    Hi all,
    I am trying to creat a new connection pool by the examples Consolewith
    WebServer
    6.0
    Name: testingPool
    URL: jdbc:cloudscape:demo or jdbc:dbc:cloudscape:Test (where Test isa new
    DB
    in cloudscape)
    Driver Name:COM.cloudscape.core.JDBCDriver
    Property:
    user=none
    password=none
    server=none
    Then create a Datasource which using the new created testingPool andthe
    Target
    is the "exampleServer"
    However when I start the server,it keeps on complaining that the"testingPool
    is not exist".
    Any setting that I 've missed when using a new connection pool??
    I only know the workaround is using the demoPool which is already existin
    the
    example.
    Any help will be very appreciate!!
    Thanks !
    Regards,
    u0p1

  • Intermittent mssql4 Connection Pool Failure problems

    Ocaisionally we are getting the following error:
    weblogic.jdbcbase.mssqlserver4.TdsConnection.registerOutgoingPipeline(TdsConnection.java:414)
    at weblogic.jdbcbase.mssqlserver4.TdsConnection.registerPipeline(TdsConnection.java:430)
    at weblogic.jdbcbase.mssqlserver4.TdsStatement.execute(TdsStatement.java:182)
    at weblogic.jdbcbase.mssqlserver4.TdsStatement.execute(TdsStatement.java:1521)
    at weblogic.jdbcbase.jts.Statement.execute(Statement.java:302)
    at weblogic.jdbc20.rmi.internal.PreparedStatementImpl.execute(PreparedStatementImpl.java:288)
    at weblogic.jdbc20.rmi.SerialPreparedStatement.execute(SerialPreparedStatement.java:398
    Once we get this error the whole connection pool is fried until we restart it.
    We are using the test connection on checkout property of the connection pool,
    so I don't understand why this problem isn't caught at connection checkout time.
    Normally if there is a problem with a connection, the connection is refreshed.
    However, sometimes, this happens.

    What version of our product? What is the whole serverside stacktrace?
    thanks,
    Joe
    Scott wrote:
    >
    Ocaisionally we are getting the following error:
    weblogic.jdbcbase.mssqlserver4.TdsConnection.registerOutgoingPipeline(TdsConnection.java:414)
    at weblogic.jdbcbase.mssqlserver4.TdsConnection.registerPipeline(TdsConnection.java:430)
    at weblogic.jdbcbase.mssqlserver4.TdsStatement.execute(TdsStatement.java:182)
    at weblogic.jdbcbase.mssqlserver4.TdsStatement.execute(TdsStatement.java:1521)
    at weblogic.jdbcbase.jts.Statement.execute(Statement.java:302)
    at weblogic.jdbc20.rmi.internal.PreparedStatementImpl.execute(PreparedStatementImpl.java:288)
    at weblogic.jdbc20.rmi.SerialPreparedStatement.execute(SerialPreparedStatement.java:398
    Once we get this error the whole connection pool is fried until we restart it.
    We are using the test connection on checkout property of the connection pool,
    so I don't understand why this problem isn't caught at connection checkout time.
    Normally if there is a problem with a connection, the connection is refreshed.
    However, sometimes, this happens.

  • Connection pool for ldap

    Hi
    My application is an interface to ldap directory. I have not used any ldap open source api to retrieve data from ldap. I have written connection pool that will help the application to connect to the ldap. It's working fine, but it's creating threads which are not invited.
    ConnectionPool class takes care of the connection storage and creation, while Housekeeping thread relases these connection when idle after a given time.
    Can someone please help in finding the problem in the code that creates additional threads.
    package com.ba.cdLookup.manager;
    import com.ba.cdLookup.exception.CDLookupException;
    import com.ba.cdLookup.server.CdLookupProperties;
    import java.util.Vector;
    import javax.naming.Context;
    import javax.naming.NamingException;
    public class HouseKeeperThread extends Thread {
             * Apache Logger to log erro/info/debug statements.
        protected static org.apache.commons.logging.Log log = org.apache.axis.components.logger.LogFactory
             .getLog(HouseKeeperThread.class.getName());
        private static HouseKeeperThread houseKeeperThread;
             * Close all connections existing.
             * @param connections
             *                void
        private void closeConnections(Vector connections) {
         String methodIdentifier = "closeConnections";
         int numOfConn = connections.size();
         try {
             for (int i = 0; i < numOfConn; i++) {
              Context context = (Context) connections.get(i);
              if (context != null) {
                  context.close();
                  context = null;
                  connections.remove(i);
                  numOfConn--;
                  log.info(" connection name:" + context
                       + " removed. Threadcount =" + (connections.size()));
         } catch (NamingException e) {
             String errMsg = "CDLdapBuilder connect() - failure while releasing connection "
                  + " Exception is " + e.toString();
             log.error(errMsg);
         } catch (Exception e) {
             String errMsg = "CDLdapBuilder connect() - failure while releasing connection "
                  + " Exception is " + e.toString();
             log.error(errMsg);
             * Thread run method
        public void run() {
         String methodIdentifier = "run";
         try {
             while(true){
              log.debug("house keeping :" + this + " ---sleep");
              //sleep(100000);
              log.debug("house keeping :" + this + " startd after sleep");
               sleep(CdLookupProperties.getHouseKeepConnectionTime());
              ConnectionPool connectionPool = ConnectionPool
                   .getConnectionPool();
              Vector connList = connectionPool.getAvailableConnections();
              closeConnections(connList);
         } catch (CDLookupException cde) {
             log.error(methodIdentifier + " " + cde.getStackTrace());
         } catch (InterruptedException ie) {
             log.error(methodIdentifier + " " + ie.getStackTrace());
         * @param connectionPool
         * @return
         * Thread
        public static Thread getInstance() {
         if(houseKeeperThread==null){
             houseKeeperThread = new HouseKeeperThread();
         return houseKeeperThread ;
    package com.ba.cdLookup.manager;
    import com.ba.cdLookup.exception.CDLookupException;
    import com.ba.cdLookup.server.CdLookupProperties;
    import com.ba.cdwebservice.schema.cdLookupPacket.LookupFailureReasons;
    import java.util.Properties;
    import java.util.Vector;
    import javax.naming.Context;
    import javax.naming.NamingException;
    import javax.naming.directory.DirContext;
    import javax.naming.directory.InitialDirContext;
    * ConnectionPool class manages, allocates LDAP connections. It works as a lazy
    * binder and retrieves connections only when required. It doesn't allow
    * connection greater then the maximum connection stated.
    * To retrieve a connection the singelton method getConnectionPool is to used,
    * which retruns thread safe singleton object for the connection.
    public class ConnectionPool implements Runnable {
        private int initialConnections = 0;
        private int maxConnections = 0;
        private boolean waitIfBusy = false;
        private Vector availableConnections, busyConnections;
        private boolean connectionPending = false;
        private static int threadCount = 0;
             * classIdentifier
        private final String classIdentifier = "ConnectionPool";
             * Apache Logger to log erro/info/debug statements.
        protected static org.apache.commons.logging.Log log = org.apache.axis.components.logger.LogFactory
             .getLog(CDLdapBuilder.class.getName());
             * To get the attribute a systemaccessfor out of the search result
        private String vendorContextFactoryClass = "com.sun.jndi.ldap.LdapCtxFactory";// "com.ibm.jndi.LDAPCtxFactory";
             * context factory to use
        private String ldapServerUrl = "LDAP://test.ldap.com"; // default ldap
             * server live used by default
        private String searchBase;
             * environment properties.
        private Properties env;
             * DirContext
        private javax.naming.directory.DirContext ctx;
             * default search base to be used in Corporate Directory searches
        private String defaultSearchBase = "dc=Pathway";
             * search criteria
        private String searchAttributes;
             * search filter to retrieve data from CD
        private String searchFilter;
             * CorporateDirectoryLookup Constructor
             * <p>
             * loads the setup parameters from the properties file and stores them
             * Makes a connection to the directory and sets default search base
             * @throws CDLookupException
             * @throws CDLookupException
        private ConnectionPool() throws CDLookupException {
         this.maxConnections = CdLookupProperties.getMaxConnection();// maxConnections;
         this.initialConnections = CdLookupProperties.getInitialConnection();
         this.waitIfBusy = CdLookupProperties.isWaitIfBusy();
         this.searchBase = CdLookupProperties.getDefaultSearchBase();
         //for local env testing
    //      this.maxConnections = 5;
    //      this.initialConnections = 1;
    //      this.waitIfBusy = true;
             * For keeping no of connections in the connection pool if
             * (initialConnections > maxConnections) { initialConnections =
             * maxConnections; }
         availableConnections = new Vector(maxConnections);
         busyConnections = new Vector(maxConnections);
         for (int i = 0; i < maxConnections; i++) {
             availableConnections.add(makeNewConnection());
             *  ConnectionPoolHolder provide Thread safe singleton
             *         instance of ConnectionPool class
        private static class ConnectionPoolHolder {
             * connection pool instance
         private static ConnectionPool connectionPool = null;
             * If no ConnectionPool object is present, it creates instance of
             * ConnectionPool class and initiates thread on that.
             * @return ConnectionPool Returns singleton object of ConnectionPool
             *         class.
             * @throws CDLookupException
         private static ConnectionPool getInstance() throws CDLookupException {
             if (connectionPool == null) {
              connectionPool = new ConnectionPool();
              new Thread(connectionPool).start();
              // Initiate house keeping thread.
              HouseKeeperThread.getInstance().start();
             return connectionPool;
             * Returns singleton object of ConnectionPool class.
             * @return ConnectionPool
             * @throws CDLookupException
        public static ConnectionPool getConnectionPool() throws CDLookupException {
         return ConnectionPoolHolder.getInstance();
             * getConnection retrieves connections to the corp directory. In case
             * there is no available connections in the pool then it'll try to
             * create one, if the max connection limit for the connection pool
             * reaches then this waits to retrieve one.
             * @return Context
             * @throws CDLookupException
        public synchronized Context getConnection() throws CDLookupException {
         String methodIdentifier = "getConnection";
         if (!availableConnections.isEmpty()) {
             int connectionSize = availableConnections.size() - 1;
             DirContext existingConnection = (DirContext) availableConnections
                  .get(connectionSize);
             availableConnections.remove(connectionSize);
                     * If connection on available list is closed (e.g., it timed
                     * out), then remove it from available list and repeat the
                     * process of obtaining a connection. Also wake up threads that
                     * were waiting for a connection because maxConnection limit was
                     * reached.
             if (existingConnection == null) {
              notifyAll(); // Freed up a spot for anybody waiting
              return (getConnection());
             } else {
              busyConnections.add(existingConnection);
              return (existingConnection);
         } else {
                     * Three possible cases: 1) You haven't reached maxConnections
                     * limit. So establish one in the background if there isn't
                     * already one pending, then wait for the next available
                     * connection (whether or not it was the newly established one).
                     * 2) You reached maxConnections limit and waitIfBusy flag is
                     * false. Throw SQLException in such a case. 3) You reached
                     * maxConnections limit and waitIfBusy flag is true. Then do the
                     * same thing as in second part of step 1: wait for next
                     * available connection.
             if ((totalConnections() < maxConnections) && !connectionPending) {
              makeBackgroundConnection();
             } else if (!waitIfBusy) {
              throw new CDLookupException("Connection limit reached", 0);
                     * Wait for either a new connection to be established (if you
                     * called makeBackgroundConnection) or for an existing
                     * connection to be freed up.
             try {
              wait();
             } catch (InterruptedException ie) {
              String errMsg = "Exception raised =" + ie.getStackTrace();
              log.error(errMsg);
              throw new CDLookupException(classIdentifier, methodIdentifier,
                   errMsg, ie);
             // connection freed up, so try again.
             return (getConnection());
             * You can't just make a new connection in the foreground when none are
             * available, since this can take several seconds with a slow network
             * connection. Instead, start a thread that establishes a new
             * connection, then wait. You get woken up either when the new
             * connection is established or if someone finishes with an existing
             * connection.
        private void makeBackgroundConnection() {
         connectionPending = true;
         try {
             Thread connectThread = new Thread(this);
             log.debug("background thread created");
             connectThread.start();
         } catch (OutOfMemoryError oome) {
             log.error("makeBackgroundConnection ="+ oome.getStackTrace());
             * Thread run method
        public void run() {
         String methodIdentifier = "run";
         try {
             Context connection = makeNewConnection();
             synchronized (this) {
              availableConnections.add(connection);
              connectionPending = false;
              notifyAll();
         } catch (Exception e) { // SQLException or OutOfMemory
             // Give up on new connection and wait for existing one
             // to free up.
             String errMsg = "Exception raised =" + e.getStackTrace();
             log.error(errMsg);   
             * This explicitly makes a new connection. Called in the foreground when
             * initializing the ConnectionPool, and called in the background when
             * running.
             * @return Context
             * @throws CDLookupException
        private Context makeNewConnection() throws CDLookupException {
         String methodIdentifier = "makeNewConnection";
         Context context = null;
         env = new Properties();
         log.debug("inside " + methodIdentifier);
         try {
             env.put(Context.INITIAL_CONTEXT_FACTORY,
                  getVendorContextFactoryClass());
             env.put(Context.PROVIDER_URL, getLdapServerUrl());
             env.put("com.sun.jndi.ldap.connect.pool", "true");
             context = new InitialDirContext(env);
         } catch (NamingException e) {
             String errMsg = "CDLdapBuilder connect() - failure while attempting to contact "
                  + ldapServerUrl + " Exception is " + e.toString();
             throw new CDLookupException(classIdentifier, methodIdentifier,
                  errMsg, e, LookupFailureReasons.serviceUnavailable);
         } catch (Exception e) {
             String errMsg = "CDLdapBuilder connect() - failure while attempting to contact "
                  + ldapServerUrl + " Exception is " + e.toString();
             throw new CDLookupException(classIdentifier, methodIdentifier,
                  errMsg, e, LookupFailureReasons.serviceUnavailable);
         log.info("new connection :" + (threadCount++) + " name =" + context);
         log.debug("exit " + methodIdentifier);
         return context;
             * releases connection to the free pool
             * @param context
        public synchronized void free(Context context) {
         busyConnections.remove(context);
         availableConnections.add(context);
         // Wake up threads that are waiting for a connection
         notifyAll();
             * @return int give total no of avail connections.
        public synchronized int totalConnections() {
         return (availableConnections.size() + busyConnections.size());
             * Close all the connections. Use with caution: be sure no connections
             * are in use before calling. Note that you are not <I>required</I> to
             * call this when done with a ConnectionPool, since connections are
             * guaranteed to be closed when garbage collected. But this method gives
             * more control regarding when the connections are closed.
        public synchronized void closeAllConnections() {
         closeConnections(availableConnections);
         availableConnections = new Vector();
         closeConnections(busyConnections);
         busyConnections = new Vector();
             * Close all connections existing.
             * @param connections
             *                void
        private void closeConnections(Vector connections) {
         String methodIdentifier = "closeConnections";
         try {
             for (int i = 0; i < connections.size(); i++) {
              Context context = (Context) connections.get(i);
              if (context != null) {
                  log.info(" connection name:" + context
                       + " removed. Threadcount =" + (threadCount++));
                  context.close();
                  context = null;
         } catch (NamingException e) {
             String errMsg = "CDLdapBuilder connect() - failure while attempting to contact "
                  + ldapServerUrl + " Exception is " + e.toString();
             log.error(errMsg);
        public synchronized String toString() {
         String info = "ConnectionPool(" + getLdapServerUrl() + ","
              + getVendorContextFactoryClass() + ")" + ", available="
              + availableConnections.size() + ", busy="
              + busyConnections.size() + ", max=" + maxConnections;
         return (info);
             * @return the defaultSearchBase
        public final String getDefaultSearchBase() {
         return defaultSearchBase;
             * @param defaultSearchBase
             *                the defaultSearchBase to set
        public final void setDefaultSearchBase(String defaultSearchBase) {
         this.defaultSearchBase = defaultSearchBase;
             * @return the ldapServerUrl
        public final String getLdapServerUrl() {
         return ldapServerUrl;
             * @param ldapServerUrl
             *                the ldapServerUrl to set
        public final void setLdapServerUrl(String ldapServerUrl) {
         this.ldapServerUrl = ldapServerUrl;
             * @return the vendorContextFactoryClass
        public final String getVendorContextFactoryClass() {
         return vendorContextFactoryClass;
             * @param vendorContextFactoryClass
             *                the vendorContextFactoryClass to set
        public final void setVendorContextFactoryClass(
             String vendorContextFactoryClass) {
         this.vendorContextFactoryClass = vendorContextFactoryClass;
         * @return the availableConnections
        public final Vector getAvailableConnections() {
            return availableConnections;
    }

    Hi,
    As the connection pool implmentation has the bug of not extending more than the min size, workaround I use is MIN_CONN=100 and MAX_CONN=101,and just waiting for the bug to get fixed. (using Netscape SDK for java4.0)

Maybe you are looking for