Hello,
I think the database is closed automatically when the last connection
is closed.
There could be several problems with your approach:
1 - You should not depend on the finalize. There is no guarantee it
will be ever called on war redeployment.
Better to have a servlet listener and listen for application destroy.
2 - Check that code closes used connections in all situations - close
them in a finally{} block.
3 - I don't know which connection pool you use, but check that it
closes all connections when you say it so.
Regards,
Rado
On Feb 21, 9:07 pm, bnschps <[email protected]> wrote:
> Thanks, I've since started it in mixed mode using auto_server=true
>
> My only problem seems to be with closing the database.
> Sometimes (frequently in my case :) ) the war file for my program is
> reinstalled and I think the connection to 'xx' database is being left
> open, as I end up getting a database is already in use error
> (Database may be already in use: Locked by another process).
>
> What I'm doing is starting a connection pool when my db class is
> initialised and calling dispose in the finalize (and conn.close if
> it's open).
> The connection object is closed after being used e.g.
>
> this.conn = this.cp.getConnection();
> xxxx
> this.conn.close();
>
> but as I say I think it's being left open in those occassions.
> Is there a way I can close any open connections or call shutdown
> somehow
>
> I did try calling shutdown but as it couldn't connect it didn't seem
> to be run
>
> thanks
> Alex
>
> On Feb 18, 7:35 am, Thomas Mueller <[email protected]>
> wrote:
>
> > Hi,
>
> > > currently I have it using embedded mode
> > > multiple tutors or students could be
> > > accessing a database at the same time
>
> > H2 supports both embedded mode, server mode, and mixed mode. I guess
> > in your case the server mode would be the easiest to maintain. See
> > alsohttp://h2database.com/html/features.html#connection_modes
>
> > Regards,
> > Thomas
--
You received this message because you are subscribed to the Google Groups "H2
Database" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/h2-database?hl=en.