Hi Murali,

The only proper way to this, is to add a shutdownhook. This is an
ordinary thread-class (a class that implements Runnable), that will
automatically be executed at the end of the current jvm, even when it's
crashed. You can in the thread-class close your database connections. 

When you created your threadclass, you can add it at the start of your
application somewhere in de code via:

// adding shutdown hook somewhere in your code
Runtime.getRuntime().addShutdownHook(new MyShutdownHookClass());

regards,
benny lootens



On Fri, 2002-09-06 at 09:29, muralipn wrote:
> Hello
> 
>     I have opened a database connection and how to do I close this
> connection
> 
>     a. when the server is closed normal through proper shutdown process
> like
>         in Tomcat 4.0 , shutdown.bat
> 
>     b. when the server is closed abnormally say crashed because of some
> action
> 
>     In the above stated conditions , how do I close the database
> connection
>     so that I can be sure that database connection is closed and when
> the
>     server is started again a fresh new database connection is created
> 
> 
> ThanX in advance
> Murali
> 
> 
> 
> 
> 
> --
> To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>




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

Reply via email to