cancel
Showing results for 
Search instead for 
Did you mean: 

Jco connection pool - Connection not released

Former Member
0 Kudos

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.

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

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

}

}

}

Former Member
0 Kudos

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.

Former Member
0 Kudos

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.

Former Member
0 Kudos

I have the same problem. any help?

thanks,

Sujatha