Skip to Content
author's profile photo Former Member
Former Member

Jco connection pool - Connection not released

Hi

I am using Jco connection pool to connect to SAP. I am using JCO.releaseClient(poolName) method to release connections back to pool. But connections don't seem to be released back to pool, pool size is growing continously, giving error message when all connections got exhausted. I am logging number of connections used after each call to release connection. I can see number of connection used is growing. My application is connecting to SAP 4.6c.

Any help is greatly appreciated.

Add a comment
10|10000 characters needed characters exceeded

Related questions

3 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Jan 12, 2005 at 09:58 PM

    I have the same problem. any help?

    thanks,

    Sujatha

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 24, 2005 at 11:39 AM

    Hi,

    Are the connections getting released to the pool and the pool size is increasing or the number of connections being consumed are increasing when you are checking the connection status in SAP?

    Because you said the connections are not being released to the pool and the pool size is increasing..?

    Do check if there is some exception occuring due to which the connections are not getting released to the pool and the open connections are hanging in SAP.

    Also you can set the timeout for each connection to check furthur.If you could send in the code for furthur details,it would be little easy to check out.

    Regards,

    Uma.

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hi,

      You should release the connection in the finally block of try catch block.

      Releasing a connection normally happens in a finally block, so that the method is always executed, independently of whether or not an exception is output. Otherwise if the connection is not released, this could lead to a shortage of available connections in the connection pool.

      try{

      System.out.println (mConnection.getAttributes () );

      }

      catch (Exception ex) {

      ex.printStackTrace ();

      }

      finally {

      JCO.releaseClient (mConnection);

      }

      Hope this helps.

  • author's profile photo Former Member
    Former Member
    Posted on Jan 25, 2005 at 03:50 PM

    I could solve my problem by releasing the connection immediately after executing the function, thus reducing the time a connection is being hold. Before I was releasing connection after manipulating with the tables and data. Hope this helps.

    For eg:

    try {

    //get connection from pool

    sapConnection.execute(sAPFunction);

    } catch (Exception e) {

    //

    } finally {

    try{

    if(sapConnection!=null){

    JCO.releaseClient (sapConnection);

    }catch(Exception ex){

    //write to log

    }

    }

    }

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.