JDBC to MySQL running out of connections - Java Composite Application Platform Suite - General Discussion(Archived)

We have a simple project which inserts data into a MySQL table. When running it seems to make 2 connections, one of which exits after 30 seconds, the other sticks around in "Sleep" mode for around 12 hours. At that time it is terminated, I believe, by MySQL but still counts as a connection in the JCAPS connection pool. There are three other projects with the same issue. They all run once a day, and after 10 days the appserver log indicates we have run out of connections. MySQL admin at the time shows no connections (other than itself).
The server log shows:
Caused by: java.sql.SQLException: JDBCADPTR-0042:
     Failed opening a database session:
     java.sql.SQLException: Error in allocating a connection.
     Cause: In-use connections equal max-pool-size and expired max-wait-time. Cannot allocate more connections.
     (MinPoolSize set in Env properties for JDBC adapters = 0, Max pool size = 10, MaxIdleTime = 30secs)
Undeploying the project(s) releases (resets?) the connections.
Has anyone else seen this behavior? Is there a way, perhaps in the JCD to close the connection?
Thanks.

Related

<Server Name>Shutdown Connection Prematurely

HI,
We are in process of doing load testing of the application. And at one scenario when, we keep 100 database connections, IAS max pool size 100 and IAS Study Pool Size 100, we get this error in Load Testing tool. And after successfull 20 user, it starts giving me error "<Web Server Name>Shutdown Connection Prematurely". And we are not able to test this scenario due to this. We tested another scenario when 1 database connection, IAS Max Pool Size 1 and Study pool size is 1. At this scenario we get 19 users going through successfully.
Thank you in advance for help.

connection pool timeout

Some of various apps deployed on my application server SE 7.1, doesn't close the connections properly. Then, sometimes is produced that pool reached max although no sql activity is done. Does anyone how to fix this problem from app server side (connection pool timeout configuration maybe) ?
thanks in advance 
Check the pool settings at :
http://docs.sun.com/source/817-2177-10/djjdbc.html#wp23051 
i've read the manual and the only property that seems to do what i want is Idle Timeout (secs),but my apps are idle in sql activiy more than default 300 secs = 5 minutes, and connections still open in database. (this property says than pool can close the connection, but it does? how i can force to close the idle connections?)
I found a faq document
http://java.sun.com/docs/performance/appserver/AppServerPerfFaq.html
where there are two new properties implicitcahingenabled and maxstatments than speed up the jdbc performance. Anybody knows where i can look for more properties to config the jdbc pool? (my db is oracle 9.2.0)
thanks a lot

IAS 6.5 closes connection ?

I have configured a third party thin driver (oracle) on IAS 6.5
When I use this driver, I get the following exception
java.sql.SQLException: Connection already closed
at com.netscape.server.jdbc.ConnectionProxy.close(Unknown Source)
Inside the code, I create a new connection before making a database call. The error comes when I try to close this connection after completing DB call.
Does IAS close third party connections automatically after use? 
No, iAS will not close connection automatically after use. If your connection is Idle more then connection time out then only it will automatically closed by iAS. 
Hi,
Just Saw your query. Not sure whether you might have resolved by now. Anyway Please check if you are trying to close the connection which is already closed by you previously. IAS will never close the connection which is not released by you.
Regds,
Surendar. 
I am using iAS connection Pool. I obtained the database connection from the pool by calling
Proxy.getConnection(); Once i complete my transaction i close my DBConnection using conn.close(); Even after closing the Connection, in the KJS* log i could see the number of reserved connection in the pool remaining the same. This reserved connection count goes on increasing till it reaches the MaxPoolSize, and then a thread runs and cleans up the Pool and the pool size is set to zero. I have checked my code thoroughly and all the Prepared Statement , Callable Statement, Resultset,Statement has been closed and that to in the right order (i.e., Resultset , followed by Prepared Statement, Followed by Connection). I am wondering why the Connection pool is not getting refreshed with a new Reserved connection count. Also, i tried accessing my system when the pool size is maximum expecting an error to be thrown, but to my surprise the code workled fine without any issues/Delays. I am posting my Datasource Pool parameters too, so that it will give a better idea.
DebugLevel : 2
MaxPoolSize : 100
MaxWait : 1
MonitorInterval : 5
SteadyPoolSize: 50
UnusedMaxLife: 5
Even with these parameters, my connection pool doesnt refresh frequently and it is reaching its max with in no time.
Any suggestions on this would be of great help to me.

Problem with connection pool and Firebird Server

Hello,
I've a confusing problem with a Firebird server and a database pool on a windows 2003 server.
Under unspecific circumstances the glassfish server throws the following exception for all attempts to get a connection from the pool:
[i]Error in allocating a connection. Cause: Connection could not be allocated because: Could not obtain connection during blocking timeout (5000 ms)[/i]
There pool is configured for 8 minimum and 100 maximum connections, but there are max. 3 connections concurrently active.
If this error has occured the only thing work to reactivate the pool is to restart the glassfish server.
I don't know if this is firebird specific or an common error.
Anyone can help or have a workaround ? My current workaround is to switch back to geronimo :-(
Bye,
Marcel
Jaybird 2.1 doesn't fix this (contrary to the message in FB Jira).
could this be because of  http://tracker.firebirdsql.org/browse/JDBC-93 ?

how to release connections back to the connection pool

I am using connection pooling and am running into the following difficulty. The web-app runs fine until it runs out of available connections and i then get this error:
[b]java.sql.SQLException: Error in allocating a connection. Cause: In-use connections equal max-pool-size and expired max-wait-time. Cannot allocate more connections.
        at com.sun.gjc.spi.base.DataSource.getConnection(DataSource.java:115)[/b]
Obviously i am not releasing the connections back to the pool when i am done using them. I thought i was by calling:
myCon.closeCon();
where myCon is the connection. How come this doesn't release the connection back to the pool? Is there are better way, or perhaps a way to force all connections to be released once the web-app is done?
many thanks
Basically, if the connection pool is configured in glassfish, you just close the connection and it gets but back into the pool.  Make sure that myCon.closeCon() actually calls myCon.close() on the connection.  This should be done in a finally clause of a try block to ensure it happens.
HTH,
TB

Categories

Resources