H2 AUTO_SERVER failed when using two JVM's

73 views
Skip to first unread message

Jijo AC

unread,
Apr 21, 2016, 1:59:37 AM4/21/16
to H2 Database
We want to connect to H2 database from our two applications(2 JVM), So we appand AUTO_SERVER=TRUE with the database URL. It works fine if we run both applications. But when we stop the first started application, the second application failed to connect and throws Connection is broken: "session closed" [90067-181]

Thomas Mueller

unread,
Apr 29, 2016, 3:09:21 PM4/29/16
to h2-da...@googlegroups.com
Hi,

This should work... Could you post a simple, complete, reproducible test case please? Best if it's two classes with with a main method in each, and System.out.println and Thread.sleep so that it's easy to reproduce.

Regards,
Thomas



On Thursday, April 21, 2016, Jijo AC <jijo...@gmail.com> wrote:
We want to connect to H2 database from our two applications(2 JVM), So we appand AUTO_SERVER=TRUE with the database URL. It works fine if we run both applications. But when we stop the first started application, the second application failed to connect and throws Connection is broken: "session closed" [90067-181]

--
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 https://groups.google.com/group/h2-database.
For more options, visit https://groups.google.com/d/optout.

Thomas Mueller

unread,
Apr 29, 2016, 3:09:28 PM4/29/16
to h2-da...@googlegroups.com
Hi,

This should work... Could you post a simple, complete, reproducible test case please? Best if it's two classes with with a main method in each, and System.out.println and Thread.sleep so that it's easy to reproduce.

Regards,
Thomas



On Thursday, April 21, 2016, Jijo AC <jijo...@gmail.com> wrote:
We want to connect to H2 database from our two applications(2 JVM), So we appand AUTO_SERVER=TRUE with the database URL. It works fine if we run both applications. But when we stop the first started application, the second application failed to connect and throws Connection is broken: "session closed" [90067-181]

--

Frank Berger

unread,
Feb 29, 2020, 10:58:44 AM2/29/20
to H2 Database
Hi Thomas,

I can reproduce it. I know for sure that it worked, because I tested it some years ago but now  it fails, but I have no idea since when.

To reproduce the issue I have 2 Groovy files appended. You may have to adapt the jdbc-url to your situation. I used an pretty old groovy version (1.8.9) but it should run with recent versions too.
The real application where it happens uses Java 8 and 9 on Linux/Mac/Windows and I can reproduce it on all 3 OS.
 
First start StartDB  which creates the DB, fills some records in a table and waits for 10 seconds.
A few seconds later start SecondDB which makes a select, which succeeds  waits some seconds, so the first process is stopped and gets an 90067-200 on the 2nd select.

I tested it on Linux with h2 1.3.175(6?) and 1.4.200 but the issue occurs on all 3 major OS I use.

Thanks in advance for your help and the excellent work you've done all the years!

best
Frank

Frank Berger

unread,
Feb 29, 2020, 10:59:35 AM2/29/20
to H2 Database
I idiot should have appended the files...
SecondDB.groovy
StartDB.groovy
Reply all
Reply to author
Forward
0 new messages