This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
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:
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.