Reputation: 1436
I have a Web Application that use Hibernate 3.0. When I restart my database server, is it always necessary to restart jboss server?
Can I reconnect to database without restart jboss server?
Upvotes: 0
Views: 216
Reputation: 14061
Depends on the pool configuration.
If you enable the "validate connection" checking, by passing a SQL to be executed before a connection is handled to the caller, your application will not get invalid connections. Meaning that the connection will be thrown out and a new one will be acquired in case the connection is broken. The price you pay for this, of course, is that you are doing a round-trip to the server.
But usually, you could leave this out and let the Exception sorter handle the case. In case JDBC problems are thrown by the Driver, this "Sorter" will analyse them and determine if the connection can be returned to the pool or not. I'm not sure about the MySQL implementation of the Exception Sorter, so, it might be worth trying. If it doesn't helps, you can always extend the existing sorter and add your logic to it.
Upvotes: 3