Class DbStarter

  • All Implemented Interfaces:
    java.util.EventListener, javax.servlet.ServletContextListener

    public class DbStarter
    extends java.lang.Object
    implements javax.servlet.ServletContextListener
    This class can be used to start the H2 TCP server (or other H2 servers, for example the PG server) inside a web application container such as Tomcat or Jetty. It can also open a database connection.
    • Constructor Summary

      Constructors 
      Constructor Description
      DbStarter()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void contextDestroyed​(javax.servlet.ServletContextEvent servletContextEvent)  
      void contextInitialized​(javax.servlet.ServletContextEvent servletContextEvent)  
      java.sql.Connection getConnection()
      Get the connection.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • DbStarter

        public DbStarter()
    • Method Detail

      • contextInitialized

        public void contextInitialized​(javax.servlet.ServletContextEvent servletContextEvent)
        Specified by:
        contextInitialized in interface javax.servlet.ServletContextListener
      • getConnection

        public java.sql.Connection getConnection()
        Get the connection.
        Returns:
        the connection
      • contextDestroyed

        public void contextDestroyed​(javax.servlet.ServletContextEvent servletContextEvent)
        Specified by:
        contextDestroyed in interface javax.servlet.ServletContextListener