I am using Sybase and the following works for me. I check to see if the
connection is closed and if it is, I replace it with a new connection.

Jeff

...
private Connection con = null;

public Connection getConnection() throws SQLException
{
   try
   {
        if (con.isClosed())
        {
           con = DriverManager.getConnection(dbURL,properties);
        }
   }
   catch(SQLException e)
   {
        return null;
   }

   return con;
}
                                                }


-----Original Message-----
From: Allen, Mark P [mailto:[EMAIL PROTECTED]]
Sent: Monday, November 29, 1999 11:43 AM
To: [EMAIL PROTECTED]
Subject: Servlet and lost database connection


We have a servlet that starts a persistent database connection  in its init
method. We used a persistent connection to increase performance.

This works great when our dba only did hot backups.  However now the entire
database is being taken down and they forget to notify us.

>From that point on our database connection is worthless.  I'm trapping on
SQLException and destroying/reloading the servlet when this occurs.

How are other people handling similar situations?

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to