wood burning stoves 2.0*
The moose likes JDBC and the fly likes database connetion Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "database connetion" Watch "database connetion" New topic
Author

database connetion

nikil shar
Ranch Hand

Joined: May 25, 2008
Posts: 116
hi all,
have a servlet which runs sql against an oracle 11g database with Oracle JDBC driver V9.2.0.1.0. For some reason i keep getting "connection closed" exception even when i detect closed connections in the code (see below) and re-establish a connection.
The app server which i have my connection pool set up in is glassfish V3




any suggestions as to what can be done to ensure a "valid" connection is available before running sql ?? Have tried calling the isValid() but don't think my driver supports it since i get sql exception for this method.

thanks very much.
Misha Ver
Ranch Hand

Joined: Mar 03, 2008
Posts: 470
nikil shar wrote:The app server which i have my connection pool set up in is glassfish V3


Perhaps you could just use "validationQuery" parameter in the connection pool setting
nikil shar
Ranch Hand

Joined: May 25, 2008
Posts: 116
hey that worked. thanks a million !!!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: database connetion
 
Similar Threads
Setting Location for database to be used by javadb
prepareStatement problem with the driver classes12.zip
how to show database table with webservice?
initialising db connection
how to retrive database table data with webService?