1

I'm working on java j2ee app. Every time when there is DB activity and DB is restarted the application goes down and we are force to bounce the app server. Once app server is bounced it works fine

Regards Pawan

Pawan Kumar
  • 154
  • 1
  • 1
  • 11

1 Answers1

1

This can happen due to Stale Connections. In such scenarios, an Exception is thrown indicating that the connection is Stale or invalid.

In the application it is possible to catch a Stale Connection Exception and retry the call. It can also be controlled by the connection timeout or time to live properties. Check with your DBA or the server administrator to see if there are any properties on the connection that is causing this.

techuser soma
  • 4,766
  • 5
  • 23
  • 43
  • Hi, in this case when DB is restarted, the DB is up even though the App remains down. The app server and DB is hosted by third party, we can only request to bounce and we have only option to take it using JAVA or J2EE code. We are using JBOSS Regards Pawan – Pawan Kumar May 30 '13 at 14:51
  • As i said, the application side handling for this would be to close the connection when a stale connection exception is thrown and retry. Looks like there is a way to handle this in jboss. Take a look at http://stackoverflow.com/questions/5088447/jboss-as-5-database-connection-pool-re-connect-routine-for-ms-sql-server and http://stackoverflow.com/questions/128527/is-there-any-way-to-have-the-jboss-connection-pool-reconnect-to-oracle-when-conn – techuser soma May 30 '13 at 19:56
  • Thanks a ton I will try the code as don't have JBoss side access – Pawan Kumar Jun 05 '13 at 08:27
  • You are welcome. I am happy that you got some idea from this answer. upvotes are welcome. – techuser soma Jun 05 '13 at 13:37