Shutdown cleanly embedded derby when tomcat shutdown ?

View: New views
4 Messages — Rating Filter:   Alert me  

Shutdown cleanly embedded derby when tomcat shutdown ?

by Albert Kam :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello Derby ..

Derby version : 10.4.1.3
Tomcat version : 5.5.25

I've tried using embedded apache derby in my webapp running in tomcat.
I register jndi datasource for derby in my tomcat. All went well, except that when i issue
shutdown.sh for the tomcat, and it seems that the tomcat process lingers (i did ps auwx | grep tomcat).
I have to kill the tomcat pid everytime now after using derby in my webapp.

Is there a clean way to shutdown apache derby datasource from tomcat ? I tried issuing :
DriverManager.getConnection("jdbc:derby:MyDbTest;shutdown=true");
in my struts' LogoutAction, but the tomcat process still lingers after shutdown.sh is issued.

Help :)

Albert Kam
--
Do not pursue the past. Do not lose yourself in the future.
The past no longer is. The future has not yet come.
Looking deeply at life as it is in the very here and now,
the practitioner dwells in stability and freedom.
(Thich Nhat Hanh)

Re: Shutdown cleanly embedded derby when tomcat shutdown ?

by francois.orsini :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello Albert,

Have you tried
DriverManager.getConnection("jdbc:derby:;shutdown=true");
instead to shutdown the whole embedded Derby instance?

Cheers

On Thu, Jun 26, 2008 at 2:21 AM, Albert Kam <moonblade.wolf@...> wrote:
Hello Derby ..

Derby version : 10.4.1.3
Tomcat version : 5.5.25

I've tried using embedded apache derby in my webapp running in tomcat.
I register jndi datasource for derby in my tomcat. All went well, except that when i issue
shutdown.sh for the tomcat, and it seems that the tomcat process lingers (i did ps auwx | grep tomcat).
I have to kill the tomcat pid everytime now after using derby in my webapp.

Is there a clean way to shutdown apache derby datasource from tomcat ? I tried issuing :
DriverManager.getConnection("jdbc:derby:MyDbTest;shutdown=true");
in my struts' LogoutAction, but the tomcat process still lingers after shutdown.sh is issued.

Help :)

Albert Kam
--
Do not pursue the past. Do not lose yourself in the future.
The past no longer is. The future has not yet come.
Looking deeply at life as it is in the very here and now,
the practitioner dwells in stability and freedom.
(Thich Nhat Hanh)


Re: Shutdown cleanly embedded derby when tomcat shutdown ?

by raykroeker :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Albert,
    Can you tell if any derby threads are still running; or equally as
interesting; did you shutdown code get called?

Raymond

On Thu, Jun 26, 2008 at 17:39, Francois Orsini
<francois.orsini@...> wrote:

> Hello Albert,
>
> Have you tried
> DriverManager.getConnection("jdbc:derby:;shutdown=true");
> instead to shutdown the whole embedded Derby instance?
>
> Cheers
>
> On Thu, Jun 26, 2008 at 2:21 AM, Albert Kam <moonblade.wolf@...>
> wrote:
>>
>> Hello Derby ..
>>
>> Derby version : 10.4.1.3
>> Tomcat version : 5.5.25
>>
>> I've tried using embedded apache derby in my webapp running in tomcat.
>> I register jndi datasource for derby in my tomcat. All went well, except
>> that when i issue
>> shutdown.sh for the tomcat, and it seems that the tomcat process lingers
>> (i did ps auwx | grep tomcat).
>> I have to kill the tomcat pid everytime now after using derby in my
>> webapp.
>>
>> Is there a clean way to shutdown apache derby datasource from tomcat ? I
>> tried issuing :
>> DriverManager.getConnection("jdbc:derby:MyDbTest;shutdown=true");
>> in my struts' LogoutAction, but the tomcat process still lingers after
>> shutdown.sh is issued.
>>
>> Help :)
>>
>> Albert Kam
>> --
>> Do not pursue the past. Do not lose yourself in the future.
>> The past no longer is. The future has not yet come.
>> Looking deeply at life as it is in the very here and now,
>> the practitioner dwells in stability and freedom.
>> (Thich Nhat Hanh)
>



--
---------------------------------------------------------
Raymond Kroeker

Parent Message unknown RE: Shutdown cleanly embedded derby when tomcat shutdown ?

by Albert Kam :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello !

Thanks for the response ..
I tried out what you said, but it still hangs, i think it could be something else T_T

Anyway, this thread also shows another approach of doing it.
http://mail-archives.apache.org/mod_mbox/db-derby-user/200609.mbox/%3c20060907215602.85178.qmail@...%3e

Yesterday from my search, i found out too about one approach that supplies another dbcp resource in tomcat that functions to shutdown derby ..

        <Resource name="jdbc/SofcoSMSShutdown" auth="Container"
              type="javax.sql.DataSource"
              maxActive="100" maxIdle="30" maxWait="10000"
              username="" password=""
              driverClassName="org.apache.derby.jdbc.EmbeddedDriver"
              url="jdbc:derby:Databases/sms;shutdown=true"/>

One just need to fetch the connection to close the database (ironic .. haha)
I think it'll work as stated by the poster, but .. havent got the time to test it yet ..


Regards,
Albert Kam

--
Do not pursue the past. Do not lose yourself in the future.
The past no longer is. The future has not yet come.
Looking deeply at life as it is in the very here and now,
the practitioner dwells in stability and freedom.
(Thich Nhat Hanh)
LightInTheBox - Buy quality products at wholesale price