Oracle Connection Pool failure in COM+

I am having some trouble trying to get a specific database to work with an application that makes use of a COM+ Application. When we point the application at the UAT database everything seems fine, but when we point it to the production database after a few successful calls it ends up failing at the COM+ application recycles. The event viewer provides the following information:
Event Type:     Error
Event Source:     COM+
Event Category:     Unknown
Event ID:     4786
Date:          8/5/2007
Time:          12:54:46 PM
User:          N/A
Computer:     APPL_SERVER
Description:
The system has called a custom component and that component has failed and generated an exception. This indicates a problem with the custom component. Notify the developer of this component that a failure has occurred and provide them with the information below.
Component Prog ID: Oracle Connection Pool - tnsnames_alias
Method Name: IDispenserDriver::CreateResource
Server Application ID: {30A93CB3-25EB-4258-8C88-5AE103B7B86F}
Server Application Instance ID:
{A57C513E-519F-45BD-B46D-DC54B285F534}
Server Application Name: COM+ Application Name
The serious nature of this error has caused the process to terminate.
Exception: C0000005
Address: 0x7C8327F9
Call Stack:
+ 0x7c8327f9
ntdll!RtlFindActivationContextSectionGuid + 0x7d2
ntdll!RtlInitializeSListHead + 0x175
ntdll!RtlFindActivationContextSectionGuid + 0x1b7
msvcrt!malloc + 0x6c
oracommon9!sktsfMalloc + 0x14
orageneric9!kpummapg + 0x58
orageneric9!kghalo + 0xabb
orageneric9!kghalf + 0x102
orageneric9!kopo2cpc + 0x61
orageneric9!kopeini + 0x1d
orageneric9!kopo2cpc + 0xd2
orageneric9!kopopgi + 0x117
OraClient9!koudpnp + 0x712
OraClient9!koudpnp + 0x101
OraClient9!kpuinit0 + 0xb19
OraClient9!kpuinit + 0x38
OraClient9!OCIEnvInit + 0x1c
oramts!kpntsrvr::kpntsrvr(class kpntdbid *) + 0x80
oramts!kpntdbid::allocNewSrvr(struct SIDAND_ATTRIBUTES *) + 0x138
oramts!kpntdbid::GetSrvr(class kpntsvrl * *,unsigned long) + 0x7df
oramts!kpntdisp::getNet8conn(class kpntsvrl * *,unsigned long) + 0x41
oramts!kpntsess::initOCI(void) + 0xec
oramts!kpntsess::sessionBegin(void) + 0x17b
oramts!kpntdisp::CreateResource(unsigned long,unsigned long *,long *) + 0xc4
COMSVCS!DispManGetContext + 0xa3d
COMSVCS!DispManGetContext + 0x1fee
oramts!kpntdisp::allocateConnection(class kpntsess * *,unsigned long,class kpntrtyp *) + 0x3c4
oramts!_kpntsvcgetex + 0x183
oramts!_kpntsvcget + 0x25
oramts!kpntctra::getConnectionAndHandles(class kpntrtyp *,struct OCISvcCtx * *,struct OCITrans * *,struct OCIError * *) + 0x87
oramts!kpntctra::abortBranch(struct xid_t &,class kpntbrnch *,struct BOID *,int,struct BOID *) + 0x15a
oramts!kpntctra::doAbort(struct BOID *,int,struct BOID *) + 0x454
oramts!kpntajob::doJob(void) + 0x27
oramts!kpntjobq::serviceRequest(class kpntjob *) + 0x3e
oramts!workerThread(void *) + 0xd0
msvcrt!_endthreadex + 0xa3
kernel32!GetModuleFileNameA + 0xeb
Not being an expert in Oracle, I have been able to dig up a little bit of information that might be of use ...
a) Our tnsnames.ora indicates that the connections are to be DEDICATED and running Toad bares this out -- dllhost ends up with a single connection.
b) most of the database initial set of parameters seem to be very similar. The only difference I noticed was that the archive log mode and db_cache_advice are ON for production.
c) We have little control over how the connection strings are being created internally in this COM+ application, but however they are created it works for UAT and doesn't for PROD.
d) When we go into our web application and hit a page that makes use of the COM+ component to render, it will work the first time but when I do a simple browser refresh it will usually fail on the 2nd or 3rd time. Almost like it is trying to expand the connection pool size and the oracle server is throwing up.
If I didn't mention earlier the two database instances run on different servers but the application server is exactly the same. We only change the alias we are using for the database (both are defined in tnsnames) and the password used to make its connection.
Does anyone have any clues on this one? I am really spinning my wheels trying to figure out what could cause this type of situation. Anything at all would be very helpful.

It appeared to us that the problem was with the Oracle server and that it might have been failing when we were trying to expand our application connection pool size or basically obtain more connections.
The biggest indicator of this is that we run the same application code against two different databases and one works and one does not work. Having said this, I suppose the problem could be rooted in a data error instead of an oracle server error ...
Is there a specific trace file on the oracle server that would help me point to any error that is truly an oracle server error? Sorry I am very new to Oracle.

Similar Messages

  • 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

  • Oracle connection pool problem (dbcp binded with  jtom)

    Hi,
    my webserver is Tomcat5.0.18, I want to offer the connection pool and transaction management
    in my currently system
    I know in Tomcat5.0 version, we can use the DBCP to offer the database connection pool
    service, to apply the transaction management in my system, I adapt the JTOM
    now, my problem is
    to use DBCP, I setup the datasource factory to be
    org.apache.commons.dbcp.BasicDataSourceFactory, the connection pool is ok, but
    the transaction management offerred by JTOM will failure
    to make the tranaction management of JTOM succeed, I have to setup the datasource factory to be
    org.objectweb.jndi.DataSourceFactory, but the connection pool offerred by Tomcat will failure now
    it seems that these two datasource factory has conflict
    How can I do?, I don't want to use the connection pool offerred in JTOM
    Anyone can help me??
    Thanks in advance

    Hi,
    I don't know the solution for JOTM, but you could try this JTA and its connection pools:
    http://www.atomikos.com ships a JTA that integrates with Tomcat and also provides JDBC connection pooling. There is a GUI control panel so that you don't have to know the XML details for Tomcat's config files.
    Best,
    Guy

  • Websphere Application Server 5.1 Hangs when using Oracle Connection Pool

    I have a j2ee application that runs on WAS 5.1 ( IBM JDK 1.4 ) and Oracle 10g 10.2.0 . My customer is doing load testing with 25 virtual users and a connection pool with a max size of 10. When the test starts all 25 users attempt to get a connection, and the first 10 get a connection. At this point the application server hangs with the connection pool in allocation. This is seen in Tivoli. Each thread only needs one connection to process it's request.
    I have my own home grown connection pool which when used under this load does not experience and issue. Monitoring from Oracle's admin console I see a max of 10 sessions. The home grows connection pool does not use a WAS DataSource.
    I have configured my application to use DB2 with a WAS DataSource and the application server does not hang. Monitoring using Tivoli shows the connection pool going into allocation, but it recovers as is expected.
    Are there any known issues with the Oracle JDBC drivers when used with WAS 5.1 DataSources?
    Any direction would be helpful, as I currently thing there is an issue with Oracle's Connection Pool and the IBM JVM.
    Thanks,
    J

    just an attention call: OracleDatasource connection pool does not accept parameters such as removeAbandoned, minEvictableIdleTimeMillis, timeBetweenEvictionRunsMillis, etc, these are specific for the tomcat dbcp implementation (http://tomcat.apache.org/tomcat-6.0-doc/jndi-resources-howto.html#JDBC_Data_Sources).
    For the accepted ones read this http://download.oracle.com/docs/cd/B28359_01/java.111/b31224/concache.htm
    Edited by: user7428636 on 24/Jan/2011 6:22

  • Connection Pool Failure: "No suitable driver"

    Hi,
    Upon server startup, I get the following result:
    <Nov 7, 2001 4:18:32 PM CST> <Error> <JDBC> <Cannot startup connection pool "ora
    cleTrufflePool" No suitable driver>
    I assumed it was a path problem, but in the startWebLogic.cmd script I've set the PATH and CLASSPATH variables to the same as in a separate command window that can successfully dbping the Oracle db.
    One thing I completely don't understand is what the URL value should be for the pool, and I can't see a pattern in the examples and docs I've found on this. Here are my pool settings, at any rate:
    Name: oracleTrufflePool
    URL: myOracleServerName
    Driver Classname: weblogic.jdbc.oci.Driver
    Properties:
    user=user
    password=password
    server=myOracleServerName
    ACLName: user
    Password: password
    As you can see, I also don't understand whether the Oracle user name and password must be duplicated in the Properties section, or should they really only be listed in the ACLName and Password fields (in the Server Console UI)?
    TIA,
    Steve

    Hi. The issue is that the URL you give is not the URL the driver (weblogic.jdbc.oci.Driver)
    wants. The URL should be "jdbc:webLogic:oci". The properties user, password and server
    will be passed to the driver for conenction attempts. The ACL is for who gets to use the
    pool, and the other password entry is only if you need the DBMS password to be encrypted
    in the XML. If so, set that password value, and don't have it in the driver properties.
    Joe
    Steve Clark wrote:
    >
    Hi,
    Upon server startup, I get the following result:
    <Nov 7, 2001 4:18:32 PM CST> <Error> <JDBC> <Cannot startup connection pool "ora
    cleTrufflePool" No suitable driver>
    I assumed it was a path problem, but in the startWebLogic.cmd script I've set the PATH and CLASSPATH variables to the same as in a separate command window that can successfully dbping the Oracle db.
    One thing I completely don't understand is what the URL value should be for the pool, and I can't see a pattern in the examples and docs I've found on this. Here are my pool settings, at any rate:
    Name: oracleTrufflePool
    URL: myOracleServerName
    Driver Classname: weblogic.jdbc.oci.Driver
    Properties:
    user=user
    password=password
    server=myOracleServerName
    ACLName: user
    Password: password
    As you can see, I also don't understand whether the Oracle user name and password must be duplicated in the Properties section, or should they really only be listed in the ACLName and Password fields (in the Server Console UI)?
    TIA,
    Steve

  • Connection Pool Failure

    Hello. I'm using wls 5.1 and Oracle 8i and an unable to make a connection pool. I keep getting the following with the message below. Where and how do I change my path?
    weblogic.common.ResourceException: weblogic.common.ResourceException:
    Could not create pool connection. The DBMS driver exception was:
    java.sql.SQLException: System.loadLibrary threw java.lang.UnsatisfiedLinkError
    'no weblogicoci36 in java.library.path'.
    at weblogic.jdbcbase.oci.Driver.connect(Driver.java:116)

    Hi,
    You need to ensure that the ORACLE_HOME is set and PATH has
    %ORACLE_HOME%\bin;%ORACLE_HOME%\lib;%WL_HOME%\bin\oci816_8 (check verison of
    database) in the server startup script.
    hth
    sree
    "Purvi" <porgie_76@> wrote in message news:3c6306f9$[email protected]..
    Hello. I'm using wls 5.1 and Oracle 8i and an unable to make a connection
    pool. I keep getting the following with the message below. Where and how do
    I change my path?
    weblogic.common.ResourceException: weblogic.common.ResourceException:
    Could not create pool connection. The DBMS driver exception was:
    java.sql.SQLException: System.loadLibrary threw
    java.lang.UnsatisfiedLinkError
    'no weblogicoci36 in java.library.path'.
    at weblogic.jdbcbase.oci.Driver.connect(Driver.java:116)

  • 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

  • Help with Oracle Connection Pooling

    Hi,
    I want to create a connection pool that can be accessible in any jsp and in any class of my web application. Is it a good idea to create a class with a static member of type OracleDataSource or any class that handles connections?

    Rafa,
    In order to use JSP, you usually need an application server.
    Oracle's application server already has connection pooling built in.
    No need to re-invent the wheel.
    (In fact most application servers provide database connection pooling.)
    Good Luck,
    Avi.

  • Urgent help (on oracle connection pool)

    Hi ,
    I downloade oracle 8i thin drivers and i am using conenction pool in my application ...
    I executed that servlet program
    When i try to get conneciton using getDatabaseConnection() method in my jsp i am getting new connection each time ...............
    In the oracel doc i read some thing like logical connections and physical connections .............
    In my code i set maxLimit to 3 and i am getting connections more than 3 ( all are different).................
    When i refresh the browser i am getting different connections like:
    con======oracle.jdbc.driver.OracleConnection@338576
    con======oracle.jdbc.driver.OracleConnection@1691dec
    con======oracle.jdbc.driver.OracleConnection@63ceb4
    con======oracle.jdbc.driver.OracleConnection@1590f50
    con======oracle.jdbc.driver.OracleConnection@aeff82
    con======oracle.jdbc.driver.OracleConnection@906e5b
    con======oracle.jdbc.driver.OracleConnection@2403cf
    con======oracle.jdbc.driver.OracleConnection@17ab157
    See i set max limit as 3 and i got more than 3 connections and each diff ................
    What is wrong in my code ............
    Please help to me ..........
    Here is the code :
    import java.io.*;
    import java.sql.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import javax.sql.*;
    import oracle.jdbc.driver.*;
    import oracle.jdbc.pool.*;
    public class PoolJdbc4 extends HttpServlet{
    private OracleConnectionPoolDataSource ocpds;
    private OracleConnectionCacheImpl ods;
    public void init(ServletConfig config) throws ServletException {
    super.init(config);
    try {
    ocpds =new OracleConnectionPoolDataSource();
    ocpds.setURL("jdbc:oracle:xxxxxxxxx");
    // ocpds.setUser("xxx");
    // ocpds.setPassword("xxx");
    // Associate it with the Cache
    ods = new OracleConnectionCacheImpl(ocpds);
    // Set the Max Limit
    ods.setMaxLimit (3);
    // Set the Scheme
    ods.setCacheScheme (OracleConnectionCacheImpl.FIXED_RETURN_NULL_SCHEME);
    catch (Exception e) {
    throw new UnavailableException(this, "Couldn't create connection pool");
    public void doGet(HttpServletRequest req, HttpServletResponse res)
    throws ServletException, IOException {
    Connection con = null;
    res.setContentType("text/plain");
    PrintWriter out = res.getWriter();
    out.println("Updating salary");
    try {
    con = ods.getConnection("xxxxx","xxx");
    System.out.println("con======="+con);
    // Turn on transactions
    con.setAutoCommit(false);
    Statement stmt=con.createStatement();
    ResultSet rs=stmt.executeQuery("select * from checkout_checkin");
    while(rs.next())
    out.println(rs.getString(1)+"<br>");
    stmt.close();
    rs.close();
    con.close();
    catch (Exception e) {
    // Any error is grounds for rollback
    try {
    con.rollback();
    catch (Exception ignored) { }
    out.println("No more connections available, try later");
    }

    ketan reddy - I'm pretty sure you are not getting a new connection each time even though you are seeing a different connection identifier printed each time you get a new connection.
    If you have system privs, try looking at v$session while your servlet is running. I think you will see that you only have a single connection and it is being used each time.
    For another test, try commenting out your conn.close() call so that you do not free up connections. Your servlet should fail after 3 executions cause it will not be able to get any more connections - because you specified
    ods.setMaxLimit (3);
    ods.setCacheScheme (OracleConnectionCacheImpl.FIXED_RETURN_NULL_SCHEME);
    Good Luck
    tim

  • 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.

  • User Level Vs. Application Level Authorization and Authentication for Container Managed Datasources (Oracle Connection Pools)

    Oracle Database Server 9i supports the usage of LABELS to enforce highly granular
    resource access restrictions at the database level independent of the application
    that is accessing it. In order to use this however, the particular user, and
    not just the application, accessing the database must be known. Oracle Application
    Server (Oracle's J2EE product line) solves this by providing the ability to PROXY
    the identity of the application user and creditials (SSL Certs for instance) down
    to the database server.
    I haven't seen a similar ability for BEA Weblogic Server 8.1 which allow the user
    identity and credientials to be PROXIED to the database server. Is this possible?
    Have I missed an important document?
    Thanks for any input,
    Raymond Tiong

    On 3 Feb 2004 12:51:26 -0800, Raymond Tiong <[email protected]> wrote:
    >
    Oracle Database Server 9i supports the usage of LABELS to enforce highly
    granular
    resource access restrictions at the database level independent of the
    application
    that is accessing it. In order to use this however, the particular
    user, and
    not just the application, accessing the database must be known. Oracle
    Application
    Server (Oracle's J2EE product line) solves this by providing the ability
    to PROXY
    the identity of the application user and creditials (SSL Certs for
    instance) down
    to the database server.
    I haven't seen a similar ability for BEA Weblogic Server 8.1 which allow
    the user
    identity and credientials to be PROXIED to the database server. Is this
    possible?
    Have I missed an important document?
    Thanks for any input,
    Raymond Tiong
    I think there is a section in the JDBC documentation for 8.1 which
    describes what it takes to utilize Oracle 9i extension called "Virtual
    Private Database". With this extension, one might be able to proxy the
    callers
    identity to the DB.
    See: http://e-docs.bea.com/wls/docs81/jdbc/thirdparty.html#1103627

  • 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

  • No connection pool with oracle thin driver

    Hi all,
    whenever I try to set up my server as target for an Oracle connection pool on OPracle
    8.1.7, I get the following exception:
    java.sql.SQLException: Illegal Arguments
    at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:168)
    at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:210)
    at oracle.jdbc.dbaccess.DBError.check_error(DBError.java:857)
    at oracle.jdbc.ttc7.TTC7Protocol.logon(TTC7Protocol.java:189)
    at oracle.jdbc.driver.OracleConnection.<init>(OracleConnection.java:249)
    at oracle.jdbc.driver.OracleDriver.getConnectionInstance(OracleDriver.java:365)
    at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:260)
    at weblogic.jdbc.common.internal.ConnectionEnvFactory.makeConnection(ConnectionEnvFactory.java:193)
    at weblogic.jdbc.common.internal.ConnectionEnvFactory.createResource(ConnectionEnvFactory.java:134)
    at weblogic.common.internal.ResourceAllocator.makeResources(ResourceAllocator.java:698)
    at weblogic.common.internal.ResourceAllocator.<init>(ResourceAllocator.java:282)
    at weblogic.jdbc.common.internal.ConnectionPool.startup(ConnectionPool.java:623)
    The Oracle driver classes12.zip is the very first in my classpath, connection pool
    settings are:
    <JDBCConnectionPool DriverName="oracle.jdbc.driver.OracleDriver"
    Name="Oracle Connection Pool"
    Properties="dll=ocijdbc8;USER=zapper;protocol=thin;PASSWORD=oracle"
    TestTableName="CABIN" URL="jdbc:oracle:thin:@192.168.0.2:1521:eins"/>
    Do I need any additional software besides the driver and weblogic??
    Thx
    Christian

    You're welcome :)
    Regards,
    Slava Imeshev
    "Christian" <[email protected]> wrote in message
    news:[email protected]...
    >
    That worked!
    Thx
    "Slava Imeshev" <[email protected]> wrote:
    Hi Christian,
    There is a couple of problems with the pool definition.
    First, the connection pool and datasource names can't
    contain spaces. Second, USER and PASSWORD
    should be in lower case, i.e. user and password accordingly.
    Regards,
    Slava Imeshev
    "Christian" <[email protected]> wrote in message
    news:[email protected]...
    Hi all,
    whenever I try to set up my server as target for an Oracle connectionpool
    on OPracle
    8.1.7, I get the following exception:
    java.sql.SQLException: Illegal Arguments
    at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:168)
    at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:210)
    at oracle.jdbc.dbaccess.DBError.check_error(DBError.java:857)
    at oracle.jdbc.ttc7.TTC7Protocol.logon(TTC7Protocol.java:189)
    at
    oracle.jdbc.driver.OracleConnection.<init>(OracleConnection.java:249)
    atoracle.jdbc.driver.OracleDriver.getConnectionInstance(OracleDriver.java:365)
    at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:260)
    atweblogic.jdbc.common.internal.ConnectionEnvFactory.makeConnection(Connection
    EnvFactory.java:193)
    at
    weblogic.jdbc.common.internal.ConnectionEnvFactory.createResource(Connection
    EnvFactory.java:134)
    at
    weblogic.common.internal.ResourceAllocator.makeResources(ResourceAllocator.j
    ava:698)
    at
    weblogic.common.internal.ResourceAllocator.<init>(ResourceAllocator.java:282
    at
    weblogic.jdbc.common.internal.ConnectionPool.startup(ConnectionPool.java:623
    The Oracle driver classes12.zip is the very first in my classpath,connection pool
    settings are:
    <JDBCConnectionPool DriverName="oracle.jdbc.driver.OracleDriver"
    Name="Oracle Connection Pool"
    Properties="dll=ocijdbc8;USER=zapper;protocol=thin;PASSWORD=oracle"
    TestTableName="CABIN" URL="jdbc:oracle:thin:@192.168.0.2:1521:eins"/>
    Do I need any additional software besides the driver and weblogic??
    Thx
    Christian

  • Threading with connection pool

    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 ejp
    Thx for the reply.
    // Enable connection pooling
    env.put("com.sun.jndi.ldap.connect.pool", "true");
    Is this suffice to get the connection pool working,
    Should i merely have a thread to maintain the connection with the ldap that uses sun's connection pool; or allow requestes to create new object for the connection and still this pool will hold.
    for example in the above code instead to housekeep the thread merely maintain connection with the pool
    or
    should I directly connect each object with the ldap?
    I am unable to understand how exactly sun's connection pool is working and how it should be used. I have gone thru the following example but picture is still hazy and undigestable to me.
    java.sun.com/products/jndi/tutorial/ldap/connect/pool.html
    Rgds

Maybe you are looking for