Hi,
I am using H2 In-Memory TCP db server. I basically follow the example code
as listed below:
final String[] args = new String[] {
"-tcpAllowOthers",
"-tcpPort", ""+serverPort
};
server = org.h2.tools.Server.createTcpServer(args).start();
...
StringBuilder sb = new StringBuilder();
sb.append("jdbc:h2:tcp://");
sb.append(getServerDomainIp());
sb.append(":");
sb.append(serverPort);
sb.append("/mem:cachedb;DB_CLOSE_DELAY=-1");
h2DbConnectStr = sb.toString();
...
Connection conn = DriverManager.getConnection(h2DbConnectStr);
// do Insert, Select, Delete, ... db operations
I use a 10000-iteration loop to test a number of DB operations.
Strangely, the statement DriverManager.getConnection(...) fails to work at
some loop iteration due to the following exception:
org.h2.jdbc.JdbcSQLException: Connection is broken:
"java.net.BindException: Address already in use: connect: localhost:8092"
[90067-196]
at org.h2.message.DbException.getJdbcSQLException(DbException.java:345)
at org.h2.message.DbException.get(DbException.java:168)
at org.h2.engine.SessionRemote.connectServer(SessionRemote.java:457)
at
org.h2.engine.SessionRemote.connectEmbeddedOrServer(SessionRemote.java:334)
at org.h2.jdbc.JdbcConnection.<init>(JdbcConnection.java:116)
at org.h2.jdbc.JdbcConnection.<init>(JdbcConnection.java:100)
at org.h2.Driver.connect(Driver.java:69)
at java.sql.DriverManager.getConnection(Unknown Source)
Before the exception occurs, the statement works as expected several
thousand times. Any idea about the cause of the problem?
Any help will be appreciated!
Michael Wu
--
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 [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/h2-database.
For more options, visit https://groups.google.com/d/optout.