com.ibm.websphere.ce.cm.ObjectClosedException: DSRA9110E: Statement is closed.
sriharish koduri
Greenhorn
Joined: Jan 18, 2009
Posts: 1
posted
0
Hi
I get the below exception when I perform any kind of database operations.
"com.ibm.websphere.ce.cm.ObjectClosedException: DSRA9110E: Statement is closed."
This is happening very randomly and currently it is happening in our QA env when we are doing some performance tests. We are using Websphere Process Server as the runtime container via which the db operations are perofmed. We have a Utility class for all the DB generic operations. That code goes as below:
/**
* @author Administrator
*
* TODO To change the template for this generated type comment go to
* Window - Preferences - Java - Code Style - Code Templates
*/
public class DBUtil {
Are we missing anything here in the above usage. We have many classes that use the above DB Utility class for all the generic DB operations.
Any help is very thankful.
Regards,
-Harish
Bauke Scholtz
Ranch Hand
Joined: Oct 08, 2006
Posts: 2458
posted
0
Two things:
1) You need to acquire and close the connection/statement/resultset in the shortest possible scope (inside same method block) to avoid resource/memory leaks.
2) You need to declare the connection/statement/resultset in the method scope as threadlocal variable and certainly not in class scope as instance variable to avoid thread-unsafety.