Package org.h2.tools

Class Console

  • All Implemented Interfaces:
    org.h2.server.ShutdownHandler
    Direct Known Subclasses:
    GUIConsole

    public class Console
    extends org.h2.util.Tool
    implements org.h2.server.ShutdownHandler
    Starts the H2 Console (web-) server, as well as the TCP and PG server.
    • Field Summary

      • Fields inherited from class org.h2.util.Tool

        out
    • Constructor Summary

      Constructors 
      Constructor Description
      Console()  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      static void main​(java.lang.String... args)
      When running without options, -tcp, -web, -browser and -pg are started.
      void runTool​(java.lang.String... args)
      This tool starts the H2 Console (web-) server, as well as the TCP and PG server.
      void shutdown()
      INTERNAL.
      • Methods inherited from class org.h2.util.Tool

        isOption, printNoDatabaseFilesFound, setOut, showUsage, showUsageAndThrowUnsupportedOption, throwUnsupportedOption
      • Methods inherited from class java.lang.Object

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

      • Console

        public Console()
    • Method Detail

      • main

        public static void main​(java.lang.String... args)
                         throws java.sql.SQLException
        When running without options, -tcp, -web, -browser and -pg are started. Options are case sensitive.
        Supported options
        [-help] or [-?] Print the list of options
        [-url] Start a browser and connect to this URL
        [-driver] Used together with -url: the driver
        [-user] Used together with -url: the user name
        [-password] Used together with -url: the password
        [-web] Start the web server with the H2 Console
        [-tool] Start the icon or window that allows to start a browser
        [-browser] Start a browser connecting to the web server
        [-tcp] Start the TCP server
        [-pg] Start the PG server
        For each Server, additional options are available; for details, see the Server tool. If a service can not be started, the program terminates with an exit code of 1.
        Parameters:
        args - the command line arguments
        Throws:
        java.sql.SQLException - on failure
      • runTool

        public void runTool​(java.lang.String... args)
                     throws java.sql.SQLException
        This tool starts the H2 Console (web-) server, as well as the TCP and PG server. A system tray icon is created, for platforms that support it. Otherwise, a small window opens.
        Specified by:
        runTool in class org.h2.util.Tool
        Parameters:
        args - the command line arguments
        Throws:
        java.sql.SQLException - on failure
      • shutdown

        public void shutdown()
        INTERNAL. Stop all servers that were started using the console.
        Specified by:
        shutdown in interface org.h2.server.ShutdownHandler