- It's not a good idea to open a connection in the init method.

- It's better to use a connection pool (e.g. DBCP from the 
  commons project) and get the connection from the pool for 
  each request (ideally this handles timeouts transparently to
  the application programmer).

- If you want to stick with your solution you can catch the 
  SQLException that is thrown and recreate the connection and 
  continue (That only works, if the driver of your db throws 
  an unambiguous Exception)

> -----Ursprüngliche Nachricht-----
> Von: Günter Kukies [mailto:[EMAIL PROTECTED]]
> Gesendet: Mittwoch, 10. Juli 2002 16:56
> An: Tomcat Users List
> Betreff: reload servlet after any Exception
> 
> my servlet opens a jdbc connection in init() (connection 
> pooling) and saves the connection in a variable.
> If the database becomes out of service for any reason, the 
> connection gets corrupted and the servlet throws a SQLException.
> Is it possible to reload (init()) the servlet after an 
> Exception (at the next servlet request), to try to connect
> when the database is up again?
>

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to