Starting the database engine without opening a console

1,438 views
Skip to first unread message

Cecil Westerhof

unread,
Mar 23, 2013, 4:16:21 AM3/23/13
to h2-da...@googlegroups.com
With h2.sh I can start the H2 database engine. But this also opens a
console. Is it possible to start the database engine without opening a
console?

--
Cecil Westerhof

Thomas Mueller

unread,
Mar 23, 2013, 4:26:49 AM3/23/13
to H2 Google Group
Hi,

I think you will need to read the documentation.

Regards,
Thomas





--
Cecil Westerhof

--
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 h2-database...@googlegroups.com.
To post to this group, send email to h2-da...@googlegroups.com.
Visit this group at http://groups.google.com/group/h2-database?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.



Cecil Westerhof

unread,
Mar 23, 2013, 4:28:57 AM3/23/13
to h2-da...@googlegroups.com
2013/3/23 Thomas Mueller <thomas.to...@gmail.com>:
> Hi,
>
> I think you will need to read the documentation.

Well properly I am not very good at reading that, because all I find is:
To start the H2 Console tool, double click the jar file, or run
java -jar h2*.jar, h2.bat, or h2.sh

--
Cecil Westerhof

Thomas Mueller

unread,
Mar 23, 2013, 4:40:03 AM3/23/13
to H2 Google Group
Hi,

With h2.sh I can start the H2 database engine.

It depends on what you mean exactly with "the database engine". An embedded database (even in-memory) is also using a "database engine". I don't think you mean that.

Maybe you mean:


But, I think this page you would have found yourself, no need to ask on the Google Group. So I guess you mean something else.

Regards,
Thomas






--
Cecil Westerhof

Cecil Westerhof

unread,
Mar 23, 2013, 4:52:13 AM3/23/13
to h2-da...@googlegroups.com
2013/3/23 Thomas Mueller <thomas.to...@gmail.com>:
>> With h2.sh I can start the H2 database engine.
>
> It depends on what you mean exactly with "the database engine". An embedded
> database (even in-memory) is also using a "database engine". I don't think
> you mean that.
>
> Maybe you mean:
>
> http://h2database.com/html/tutorial.html#using_server
>
> But, I think this page you would have found yourself, no need to ask on the
> Google Group. So I guess you mean something else.

No that is more ore less what I mend. I am a bit further now. With:
java -cp h2*.jar org.h2.tools.Server -tcp -web

I am on the right track. I can open a console in my webbrowser if I
want and I can connect from my server. But when I start it without
options, I get a widget. I would prefer to not open a console in my
webbrowser, but still have a widget. If that is not possible, I will
stick with the old situation.

--
Cecil Westerhof

Thomas Mueller

unread,
Mar 23, 2013, 5:02:37 AM3/23/13
to H2 Google Group
Hi,

I'm not sure what you mean with widget, maybe this?

    java org.h2.tools.Console -tool

Regards,
Thomas



--
Cecil Westerhof

Cecil Westerhof

unread,
Mar 23, 2013, 5:16:58 AM3/23/13
to h2-da...@googlegroups.com
2013/3/23 Thomas Mueller <thomas.to...@gmail.com>:
> I'm not sure what you mean with widget, maybe this?
>
> java org.h2.tools.Console -tool

This gives:
Exception in thread "main" org.h2.jdbc.JdbcSQLException: Feature
not supported: "-tool" [50100-169]

I am still using 1.3.169. Should I upgrade?


By the way with widget I mean the following. When starting the
shellscript I get the widget in my panel. It shows a little disk (see
attachment). When I click on it, it opens a console in the webbrowser.
When I right click on it, I get a menu with three options: "H2
Console", "Status" and "Exit".

--
Cecil Westerhof
H2Widget.png

Thomas Mueller

unread,
Mar 23, 2013, 5:49:02 AM3/23/13
to H2 Google Group
Hi,

Hm, it should work with 1.3.169 as well. Could you post the full stack trace?

Regards,
Thomas




--
Cecil Westerhof

Cecil Westerhof

unread,
Mar 23, 2013, 6:03:52 AM3/23/13
to h2-da...@googlegroups.com
2013/3/23 Thomas Mueller <thomas.to...@gmail.com>:
> Hm, it should work with 1.3.169 as well. Could you post the full stack
> trace?

It does not work on 1.3.171 also. :-(

When executing:
java -cp h2-1.3.171.jar org.h2.tools.Server -?
I get:
Starts the H2 Console (web-) server, TCP, and PG server.
Usage: java org.h2.tools.Server <options>
When running without options, -tcp, -web, -browser and -pg are started.
Options are case sensitive. Supported options are:
[-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)
[-properties "<dir>"] Server properties (default: ~, disable: null)
[-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)
The options -xAllowOthers are potentially risky.
For details, see Advanced Topics / Protection against Remote Access.
See also http://h2database.com/javadoc/org/h2/tools/Server.html

No -tool mentioned.

The following seems to work;
java -cp h2-1.3.171.jar org.h2.tools.Server -tcp -web

But when I execute:
java -cp h2-1.3.171.jar org.h2.tools.Server -tcp -tool -web
I get:
Starts the H2 Console (web-) server, TCP, and PG server.
Usage: java org.h2.tools.Server <options>
When running without options, -tcp, -web, -browser and -pg are started.
Options are case sensitive. Supported options are:
[-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)
[-properties "<dir>"] Server properties (default: ~, disable: null)
[-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)
The options -xAllowOthers are potentially risky.
For details, see Advanced Topics / Protection against Remote Access.
See also http://h2database.com/javadoc/org/h2/tools/Server.html
Exception in thread "main" org.h2.jdbc.JdbcSQLException: Feature
not supported: "-tool" [50100-171]
at org.h2.message.DbException.getJdbcSQLException(DbException.java:329)
at org.h2.message.DbException.get(DbException.java:169)
at org.h2.message.DbException.get(DbException.java:146)
at org.h2.util.Tool.throwUnsupportedOption(Tool.java:66)
at org.h2.util.Tool.showUsageAndThrowUnsupportedOption(Tool.java:56)
at org.h2.tools.Server.runTool(Server.java:288)
at org.h2.tools.Server.main(Server.java:117)

This is on openSUSE 12.1 with kernel 3.1.10-1.19-desktop and java
version "1.6.0_27", OpenJDK Runtime Environment (IcedTea6 1.12.4)
(suse-32.1-i386) and OpenJDK Client VM (build 20.0-b12, mixed mode).

By the way: do I need to take precautions with the upgrade, or should
it just work?

--
Cecil Westerhof

Thomas Mueller

unread,
Mar 23, 2013, 6:38:23 AM3/23/13
to H2 Google Group
Hi,

You started the Server tool, not the Console tool. See my original mail.

Regards,
Thomas




--
Cecil Westerhof

Cecil Westerhof

unread,
Mar 25, 2013, 2:49:02 AM3/25/13
to h2-da...@googlegroups.com
2013/3/23 Thomas Mueller <thomas.to...@gmail.com>:
> You started the Server tool, not the Console tool. See my original mail.

The two look a lot alike. :-(

I now use:
java -cp h2-1.3.171.jar org.h2.tools.Console -tool -tcp &

No -pg because I do not use Postgress.

Would it not be an idea to add this to:
http://h2database.com/html/tutorial.html

--
Cecil Westerhof
Reply all
Reply to author
Forward
0 new messages