db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sai Pullabhotla" <sai.pullabho...@jmethods.com>
Subject Re: Derby in Tomcat webapps
Date Thu, 29 May 2008 18:08:10 GMT
I solved this issue in my web app doing the following:

1. Create two JNDI data sources to the same database - one a normal
connection and another one for shutdown (in the JDBC URL, specify
shutdown=true.
2. Create a ServletContextListener and register it with Tomcat in the
web.xml file so you receive notification when the context is
initialized or destroyed.
3. In the destroyed method, get a connection from the DataSource that
was added specifically to shut down the Derby database cleanly.

This has been working great for us so far. Hope this helps to you too.

Regards,
Sai Pullabhotla

On Thu, May 29, 2008 at 10:55 AM, Donald McLean <dmclean62@gmail.com> wrote:
> The new version of our webapp uses Tomcat (and it works like a champ!) but
> there are a couple of annoying issues that I would like to resolve:
>
> 1. When I unload and then reload the app, the new instance of the app can't
> start the database. I have to stop and then start Tomcat.
>
> 2. When I try to run a second app that uses Tomcat, it can't start the
> database.
>
> I would greatly appreciate some suggestions as to how I should modify my
> configuration so that I can resolve these problems.
>
> Thank you,
>
> Donald
>



-- 
Sai Pullabhotla
Phone: (402) 408-5753
Fax: (402) 408-6861
www.jMethods.com

Mime
View raw message