|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.h2.util.Tool
org.h2.tools.Server
public class Server
Starts the H2 Console (web-) server, TCP, and PG server.
Field Summary |
---|
Fields inherited from class org.h2.util.Tool |
---|
out |
Constructor Summary | |
---|---|
Server()
|
|
Server(Service service,
java.lang.String... args)
Create a new server for the given service. |
Method Summary | |
---|---|
static Server |
createPgServer(java.lang.String... args)
Create a new PG server, but does not start it yet. |
static Server |
createTcpServer(java.lang.String... args)
Create a new TCP server, but does not start it yet. |
static Server |
createWebServer(java.lang.String... args)
Create a new web server, but does not start it yet. |
int |
getPort()
Gets the port this server is listening on. |
Service |
getService()
Get the service attached to this server. |
java.lang.String |
getStatus()
Get the status of this server. |
java.lang.String |
getURL()
Gets the URL of this server. |
boolean |
isRunning(boolean traceError)
Checks if the server is running. |
static void |
main(java.lang.String... args)
When running without options, -tcp, -web, -browser and -pg are started. |
static void |
openBrowser(java.lang.String url)
Open a new browser tab or window with the given URL. |
void |
run()
INTERNAL |
void |
runTool(java.lang.String... args)
Run the tool with the given output stream and arguments. |
void |
setShutdownHandler(ShutdownHandler shutdownHandler)
INTERNAL |
void |
shutdown()
INTERNAL |
static void |
shutdownTcpServer(java.lang.String url,
java.lang.String password,
boolean force,
boolean all)
Shutdown one or all TCP server. |
Server |
start()
Tries to start the server. |
static void |
startWebServer(java.sql.Connection conn)
Start a web server and a browser that uses the given connection. |
void |
stop()
Stops the server. |
Methods inherited from class org.h2.util.Tool |
---|
printNoDatabaseFilesFound, setOut, showUsage, throwUnsupportedOption |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Server()
public Server(Service service, java.lang.String... args) throws java.sql.SQLException
service
- the serviceargs
- the command line arguments
java.sql.SQLException
Method Detail |
---|
public static void main(java.lang.String... args) throws java.sql.SQLException
[-help] or [-?] | Print the list of options |
[-web] | Start the web server with the H2 Console |
[-webAllowOthers] | Allow other computers to connect - see below |
[-webDaemon] | Use a daemon thread |
[-webPort <port>] | The port (default: 8082) |
[-webSSL] | Use encrypted (HTTPS) connections |
[-browser] | Start a browser connecting to the web server |
[-tcp] | Start the TCP server |
[-tcpAllowOthers] | Allow other computers to connect - see below |
[-tcpDaemon] | Use a daemon thread |
[-tcpPort <port>] | The port (default: 9092) |
[-tcpSSL] | Use encrypted (SSL) connections |
[-tcpPassword <pwd>] | The password for shutting down a TCP server |
[-tcpShutdown "<url>"] | Stop the TCP server; example: tcp://localhost |
[-tcpShutdownForce] | Do not wait until all connections are closed |
[-pg] | Start the PG server |
[-pgAllowOthers] | Allow other computers to connect - see below |
[-pgDaemon] | Use a daemon thread |
[-pgPort <port>] | The port (default: 5435) |
[-baseDir <dir>] | The base directory for H2 databases (all servers) |
[-ifExists] | Only existing databases may be opened (all servers) |
[-trace] | Print additional trace information (all servers) |
args
- the command line arguments
java.sql.SQLException
public void runTool(java.lang.String... args) throws java.sql.SQLException
Tool
runTool
in class Tool
args
- the argument list
java.sql.SQLException
public static void shutdownTcpServer(java.lang.String url, java.lang.String password, boolean force, boolean all) throws java.sql.SQLException
Server.shutdownTcpServer( "tcp://localhost:9094", password, true, false);
url
- example: tcp://localhost:9094password
- the password to use ("" for no password)force
- the shutdown (don't wait)all
- whether all TCP servers that are running in the JVM
should be stopped
java.sql.SQLException
public java.lang.String getStatus()
public static Server createWebServer(java.lang.String... args) throws java.sql.SQLException
Server server = Server.createWebServer( new String[] { "-trace" }).start();
args
- the argument list
java.sql.SQLException
public static Server createTcpServer(java.lang.String... args) throws java.sql.SQLException
Server server = Server.createTcpServer( new String[] { "-tcpAllowOthers" }).start();
args
- the argument list
java.sql.SQLException
public static Server createPgServer(java.lang.String... args) throws java.sql.SQLException
Server server = Server.createPgServer("-pgAllowOthers").start();
args
- the argument list
java.sql.SQLException
public Server start() throws java.sql.SQLException
java.sql.SQLException
- if the server could not be startedpublic boolean isRunning(boolean traceError)
traceError
- if errors should be written
public void stop()
public java.lang.String getURL()
public int getPort()
public void run()
run
in interface java.lang.Runnable
public void setShutdownHandler(ShutdownHandler shutdownHandler)
public void shutdown()
shutdown
in interface ShutdownHandler
public Service getService()
public static void openBrowser(java.lang.String url)
url
- the URL to openpublic static void startWebServer(java.sql.Connection conn) throws java.sql.SQLException
conn
- the database connection (the database must be open)
java.sql.SQLException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |