You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by steve kerver <st...@yahoo.com> on 2008/04/03 21:45:20 UTC

How to get Tomcat to pick up Oracle database connections after database shutdown?

Hi- I'm an Oracle DBA, but since I work in a small
company, I've been tasked with restarting our Tomcat
servers everytime I have to shut down or restart our
database.

(If I shutdown the Oracle database and then don't do a
Tomcat restart when the database comes back up, we get
HTTP 500 errors).

To me, this seems silly though- Tomcat should be able
to be aware that no database connection is available,
but when one *does* become available, it should just
pick it up, instead of requiring a restart.

 Does anyone here know how to configure this?

 Also- FYI, we are using Hibernate.

 Any help would be greatly appreciated.

  Thanks!
   -Steve.


      ____________________________________________________________________________________
You rock. That's why Blockbuster's offering you one month of Blockbuster Total Access, No Cost.  
http://tc.deals.yahoo.com/tc/blockbuster/text5.com

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: How to get Tomcat to pick up Oracle database connections after database shutdown?

Posted by Felix Schumacher <fe...@internetallee.de>.
On Thu, April 3, 2008 9:45 pm, steve kerver wrote:
> ...
> (If I shutdown the Oracle database and then don't do a
> Tomcat restart when the database comes back up, we get
> HTTP 500 errors).
> ...
>  Also- FYI, we are using Hibernate.
You are not telling us, which tomcat version, java version or OS you are
using. And we can only guess, if your hibernate app uses it's own database
connection pool or one supplied by the tomcat container.

If you are using a database connection pool supplied by tomcat v6.0 than you
should look at it's documentation at

http://tomcat.apache.org/tomcat-6.0-doc/jndi-datasource-examples-howto.html

and follow the link to the commons-dbcp documentation at

http://commons.apache.org/dbcp/configuration.html

The Parameters
 - validationQuery
 - testOnBorrow
will be of particular interest to you.

HTH
 Felix
>
>  Any help would be greatly appreciated.
>
>   Thanks!
>    -Steve.



---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: How to get Tomcat to pick up Oracle database connections after database shutdown?

Posted by David Fisher <df...@jmlafferty.com>.
I think you are correct. We manage our Oracle connections ourselves  
using classes12 and a ConnectionPool. I have no need to restart tomcat  
after an Oracle "bounce". I do restart my Tomcats much more often than  
Oracle - every day. It has been almost a year since we restarted Oracle.

It could be that Hibernate is your issue. I know that Tomcat can  
manage connections perhaps there is something in that configuration  
that will help.

Good luck.

Dave

On Apr 3, 2008, at 2:45 PM, steve kerver wrote:

> Hi- I'm an Oracle DBA, but since I work in a small
> company, I've been tasked with restarting our Tomcat
> servers everytime I have to shut down or restart our
> database.
>
> (If I shutdown the Oracle database and then don't do a
> Tomcat restart when the database comes back up, we get
> HTTP 500 errors).
>
> To me, this seems silly though- Tomcat should be able
> to be aware that no database connection is available,
> but when one *does* become available, it should just
> pick it up, instead of requiring a restart.
>
> Does anyone here know how to configure this?
>
> Also- FYI, we are using Hibernate.
>
> Any help would be greatly appreciated.
>
>  Thanks!
>   -Steve.
>
>
>       
> ____________________________________________________________________________________
> You rock. That's why Blockbuster's offering you one month of  
> Blockbuster Total Access, No Cost.
> http://tc.deals.yahoo.com/tc/blockbuster/text5.com
>
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: How to get Tomcat to pick up Oracle database connections after database shutdown?

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Steve,

steve kerver wrote:
| (If I shutdown the Oracle database and then don't do a
| Tomcat restart when the database comes back up, we get
| HTTP 500 errors).

Are you getting exceptions in Tomcat's logs? If so, what are they?

I'm guessing that your JDBC connections are poorly set-up.

Do you get to configure the connection pool at all through Hibernate?
You need to have your connection pool test connections before attempting
to use them.

Tomcat uses Commons DBCP which allows for a "validation query" that gets
executed as a test before any "real" query goes through. Any connections
that are dead (because of an Oracle bounce, for instance) will be cycled
out of the pool and replaced with good ones. No need to restart Tomcat
after a db bounce.

I have to imagine that Hibernate is able to do this as well.

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.8 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkf2QEcACgkQ9CaO5/Lv0PBFugCgl+GrCPSfSbutHP2k/cm007ro
b6kAn1TmoVPC/DHu753GtN7BLs9aCNXO
=FflQ
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org