closing old connections from h2 console

32 views
Skip to first unread message

Adam McMahon

unread,
Sep 27, 2012, 9:28:27 AM9/27/12
to h2-da...@googlegroups.com
Hi,

I am using H2 embedded in a web app with db_close_delay=-1.  The code in my app closes connections fine.  However, on occasion we use the h2 web console to manage things.  Since it is in a web browser, on occasion we close the browser while forgetting to hit the disconnect button (I know, human error... but we are used to simply closing browsers when we are done with them).   This leaves a few connections that seem to stick around for a while.  Is there a way I can run either a function or sql command to clean up connections that have been around for a period of time?

Another possible idea is to add an onUnload event to the console html that send a quick ping to servlet to close the connection.  I might just add this if there is not a good solution.

-Adam

Thomas Mueller

unread,
Sep 30, 2012, 12:47:20 PM9/30/12
to h2-da...@googlegroups.com
Hi,

The db_close_delay is a delay and should do what you are looking for. For example db_close_delay=10 will close the database if there are no open connections for 10 seconds. See also http://h2database.com/html/grammar.html?highlight=DB_CLOSE_DELAY&search=db_close#set_db_close_delay

Regards,
Thomas




-Adam

--
You received this message because you are subscribed to the Google Groups "H2 Database" group.
To view this discussion on the web visit https://groups.google.com/d/msg/h2-database/-/1_xsS7F2vqkJ.
To post to this group, send email to h2-da...@googlegroups.com.
To unsubscribe from this group, send email to h2-database...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/h2-database?hl=en.

Adam McMahon

unread,
Oct 2, 2012, 7:55:55 PM10/2/12
to h2-da...@googlegroups.com
Thomas,

Thanks for the feedback...

-Adam
Reply all
Reply to author
Forward
0 new messages