Can not connect to h2 server from console

908 views
Skip to first unread message

jomarlla

unread,
Feb 22, 2011, 12:07:06 PM2/22/11
to H2 Database
Hi all,
I have an H2 server running successfully with the -tcp option:

TCP server running at tcp://127.0.1.1:9092 (only local connections)
...

but I can not connect from h2 console since h2 console starts a Tcp
server by default and it uses the same port. It didnt happen to me in
the 1.2.147 version. Im using now 1.3.151..

With h2 1.2.147, even though the h2 console threw an exception it
started with the web browser and I couldnt setup the connection.

What am i doing wrong?
Best,
Jose


The TCP server could not be started. Possible cause: another server is
already running at tcp://127.0.1.1:9092
Root cause: Exception opening port "9092" (port may be in use), cause:
"java.net.BindException: Address already in use" [90061-151]
Exception in thread "main" org.h2.jdbc.JdbcSQLException: Exception
opening port "9092" (port may be in use), cause:
"java.net.BindException: Address already in use" [90061-151]
at org.h2.message.DbException.getJdbcSQLException(DbException.java:
327)
at org.h2.message.DbException.get(DbException.java:156)
at org.h2.util.NetUtils.createServerSocketTry(NetUtils.java:175)
at org.h2.util.NetUtils.createServerSocket(NetUtils.java:141)
at org.h2.server.TcpServer.start(TcpServer.java:218)
at org.h2.tools.Server.start(Server.java:362)
at org.h2.tools.Console.runTool(Console.java:207)
at org.h2.tools.Console.main(Console.java:101)
Caused by: java.net.BindException: Address already in use
at java.net.PlainSocketImpl.socketBind(Native Method)
at java.net.PlainSocketImpl.bind(PlainSocketImpl.java:365)
at java.net.ServerSocket.bind(ServerSocket.java:328)
at java.net.ServerSocket.<init>(ServerSocket.java:194)
at java.net.ServerSocket.<init>(ServerSocket.java:106)
at org.h2.util.NetUtils.createServerSocketTry(NetUtils.java:171)




Thomas Mueller

unread,
Feb 26, 2011, 1:36:15 PM2/26/11
to h2-da...@googlegroups.com
Hi,

> I have an H2 server running successfully with the -tcp option:
> TCP server running at tcp://127.0.1.1:9092 (only local connections)

> but I can not connect from h2 console since h2 console starts a Tcp


> server by default and it uses the same port.

Yes, you will have to either change the TCP port or only start the web
server. To start the H2 Console only, use:

java -jar *.jar -web -browser

> It didnt happen to me in
> the 1.2.147 version. Im using now 1.3.151..

You are right, this was changed recently.

> What am i doing wrong?

Nothing, really, but I'm not sure if I want to go back to the old
behavior. One solution might be to automatically change the port(s) on
startup if another service is already running there.

Regards,
Thomas

jomarlla

unread,
Feb 26, 2011, 4:15:56 PM2/26/11
to H2 Database
Hi Thomas,
Thanks for the answer.
Using -web -browser, h2 console is working perfectly.
Best,
Jose



On Feb 26, 7:36 pm, Thomas Mueller <thomas.tom.muel...@gmail.com>
wrote:

Thomas Mueller

unread,
Mar 2, 2011, 2:32:27 PM3/2/11
to h2-da...@googlegroups.com
Hi,

Could you try again using the latest version of H2 (1.3.152)? It
should be fixed now.

Regards,
Thomas

Reply all
Reply to author
Forward
0 new messages