I didnt have the problem when using jdbc directly (using a modified
genericdatasource from the struts-legacy jar).
When the application was stopped and started the connection pool was
destroyed, so the database closed.

Is there anything i can add to the destroy method to completely shutdown the
database connection?

Thanks,
Daniel.

----- Original Message ----- 
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Wednesday, October 15, 2003 6:18 PM
Subject: Re: OJB + STRUTS + HSQLDB -> restarting application


Daniel,

I think you'll find it is a HSQLDB/Tomcat issue not an OJB. The HSQLDB
connection cannot be reused across different class loaders.

When Tomcat reloads a webapp I think it effectively reopens it using a new
class loader but I believe the underlying HSQLDB connection is not destroyed
unless Tomcat is actually stopped and started.

I have the same problem, in development I have to live with stopping and
starting Tomcat. In production it should not be an issue as you should not
need to reload the web application as often (if at all).

Regards,

Joss


> Hi,
>I'm using OJB with struts to access an hsqldb database, running in embedded
>mode.
>With embedded mode is that one one connection can be established to the
>database at a time.
>I've got the database working fine, but.....
>
>The problem is that if i stop the application in tomcat, and then start it
>again it throws an exception saying the database is already in use.
>Stopping tomcat completely and starting it again works, but is very time
>consuming when compared to stopping/starting the application.
>
>I'm using a sturts plugin to connect to the database as follows:
>
>odmg = OJB.getInstance();
>db = odmg.newDatabase();
>try {
>    db.open("default", Database.OPEN_READ_WRITE);
>} catch (Exception ex) {
>    ex.printStackTrace();
>}
>
>It then hands out references to odmg so that various data services can get
>at the data.
>
>This is working fine.
>
>The plugin closes the database when in it's destroy method is called as
>follows:
>
>try {
>    db.close();
>    System.out.println("closing complete");
>} catch (Exception ex) {
>    System.out.println("*** ERROR: db.close causes error ***");
>    ex.printStackTrace();
>}
>
>This seems to execute properly as "closing complete" is printed in the
>stdout file.
>
>Is there somthing more i need to do to close the database???
>
>Thanks,
>
>Daniel.
>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]



--------------------
talk21 your FREE portable and private address on the net at
http://www.talk21.com


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



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

Reply via email to