Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Database reconnecxion  RSS feed

 
Olivier Scalbert
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

In short, I am writing a JSF application that exposes a mysql database through JPA entities and stateless session bean.
I am using glassfish.
I have a question on robustness. If I shutdown the mysql server, of course I have exceptions as soon as I try to access the database.
As I catch the exceptions, the JSF app is still alive.
If I restart the mysql server, how could I automatically recreate the db connexion to glassfish ?
I am using hibernate.

Thanks,

Olivier
 
Reza Rahman
author
Ranch Hand
Posts: 580
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Olivier,

You'd have to check with the GlassFish folks, but the DB connection pools should recover by themselves once the database is online again.

Thanks,
Reza
 
RaviNada Kiran
Ranch Hand
Posts: 528
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Reza is correct here.

The server keeps on making a connection to the resource followed by a specific interval of time(server specific)
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!