H2 Database (embedded) connection timeout

2,510 views
Skip to first unread message

Michael

unread,
Dec 14, 2010, 3:20:28 AM12/14/10
to H2 Database
I get the following exception when connecting to the database:

org.h2.jdbc.JdbcSQLException: Connection is broken: "connect timed
out" [90067-142]
at org.h2.message.DbException.getJdbcSQLException(DbException.java:
327)
at org.h2.message.DbException.get(DbException.java:156)
at org.h2.engine.SessionRemote.connectServer(SessionRemote.java:
326)
at
org.h2.engine.SessionRemote.connectEmbeddedOrServer(SessionRemote.java:
248)
at org.h2.engine.SessionRemote.createSession(SessionRemote.java:
214)
at org.h2.jdbc.JdbcConnection.<init>(JdbcConnection.java:111)
at org.h2.jdbc.JdbcConnection.<init>(JdbcConnection.java:95)
at org.h2.Driver.connect(Driver.java:73)
at java.sql.DriverManager.getConnection(DriverManager.java:582)
at java.sql.DriverManager.getConnection(DriverManager.java:185)
................
Caused by: java.net.SocketTimeoutException: connect timed out
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333)
at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:
195)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)
at java.net.Socket.connect(Socket.java:525)
at org.h2.util.NetUtils.createSocket(NetUtils.java:109)
at org.h2.util.NetUtils.createSocket(NetUtils.java:91)
at org.h2.engine.SessionRemote.initTransfer(SessionRemote.java:92)
at org.h2.engine.SessionRemote.connectServer(SessionRemote.java:
322)
... 38 more

The connection string looks as follows:
jdbc:h2:C:\Users\Michael\.myadd\db;AUTO_SERVER=TRUE;CIPHER=AES

What can be the reason for such exception?

Thanks!

Thotheolh

unread,
Dec 14, 2010, 8:17:14 AM12/14/10
to H2 Database
Your JDBC String:"jdbc:h2:C:\Users\Michael\.myadd
\db;AUTO_SERVER=TRUE;CIPHER=AES", includes a server. I think that's
why it timed out because of the server. Why do you open a server when
you are attempting to use embedded mode ?

Thotheolh

unread,
Dec 14, 2010, 8:19:40 AM12/14/10
to H2 Database
By the way, you can use '~' character in your JDBC URL String to
represent user home folder. Something like 'jdbc:h2:~/.myadd/db'.

Thomas Mueller

unread,
Dec 14, 2010, 4:35:03 PM12/14/10
to h2-da...@googlegroups.com
Hi,

You have asked the question here plus you have asked at
http://stackoverflow.com/questions/4437153/h2-database-embedded-connection-timeout

It's better to only ask at one place.

Regards,
Thomas

> --
> You received this message because you are subscribed to the Google Groups "H2 Database" group.
> To post to this group, send email to h2-da...@googlegroups.com.
> To unsubscribe from this group, send email to h2-database...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/h2-database?hl=en.
>
>

Reply all
Reply to author
Forward
0 new messages