Web application with embedded database managed by this application must 
have a ServletContextListener. In its contextDestroyed() method it must 
shutdown the database properly.

For example, application can use a org.h2.jdbcx.JdbcConnectionPool to 
allocate its connections. It can be constructed with separately created 
org.h2.jdbcx.JdbcDataSource.

contextDestroyed() can execute everything you need during unloading of your 
application first, then it should dispose the connection pool to prevent 
allocations of new connections by some leftover parts of your application, 
and finally it must execute the SHUTDOWN command, it can allocate an own 
connection directly from the data source for this command or use some 
previously created connection. Possible exceptions from this special 
connection should normally be ignored.

For Apache Tomcat running as a system service that logic should provide 
enough safety by itself. But there are other servers and it is possible to 
launch them in various ways, so in some cases your application may need 
some additional protection.

-- 
You received this message because you are subscribed to the Google Groups "H2 
Database" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/h2-database/e5cf8dda-1d7a-4c21-919b-7cfa923d0df6n%40googlegroups.com.

Reply via email to