Top Description Fields Constructors Methods
org.h2.tools

public Class Console

extends Tool
implements ShutdownHandler
Class Inheritance
All Implemented Interfaces
org.h2.server.ShutdownHandler
Known Direct Subclasses
org.h2.tools.GUIConsole
Imports
java.sql.Connection, .SQLException, org.h2.server.ShutdownHandler, org.h2.util.JdbcUtils, .MathUtils, .StringUtils, .Tool, .Utils

Starts the H2 Console (web-) server, as well as the TCP and PG server.
Author
Thomas Mueller, Ridvan Agar

Field Summary

Modifier and TypeField and Description
pack-priv boolean
private Server
private Server
pack-priv Server
Inherited from org.h2.util.Tool:
out

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public static void
main(String...
the command line arguments
args
)

When running without options, -tcp, -web, -browser and -pg are started.

pack-priv void
openBrowser(String
the URL to open
url
)

Open a new browser tab or window with the given URL.

private void
public void
runTool(String...
the command line arguments
args
)

Implements abstract org.h2.util.Tool.runTool.

This tool starts the H2 Console (web-) server, as well as the TCP and PG server.

pack-priv void
show()

Overridden by GUIConsole to show a window

public void
Inherited from org.h2.util.Tool:
getMainClassNameisOptionprintNoDatabaseFilesFoundsetOutshowUsageshowUsageAndThrowUnsupportedOptionthrowUnsupportedOption

Field Detail

isWindowsback to summary
pack-priv boolean isWindows
pgback to summary
private Server pg
tcpback to summary
private Server tcp
webback to summary
pack-priv Server web

Constructor Detail

Consoleback to summary
public Console()

Method Detail

mainback to summary
public static void main(String... args) throws 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:String[]

the command line arguments

Exceptions
SQLException:
on failure
openBrowserback to summary
pack-priv void openBrowser(String url)

Open a new browser tab or window with the given URL.

Parameters
url:String

the URL to open

printProblemback to summary
private void printProblem(Exception e, Server server)
runToolback to summary
public void runTool(String... args) throws SQLException

Implements abstract org.h2.util.Tool.runTool.

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.

Parameters
args:String[]

the command line arguments

Annotations
@Override
Exceptions
SQLException:

Doc from org.h2.util.Tool.runTool.

on failure

showback to summary
pack-priv void show()

Overridden by GUIConsole to show a window

shutdownback to summary
public void shutdown()

Implements org.h2.server.ShutdownHandler.shutdown.

INTERNAL. Stop all servers that were started using the console.

Annotations
@Override