Hi,

What version of H2 do you use? It should work even when using multiple
threads. Could you post a simple test case that fails please? See my
test case (that works) below.

Regards,
Thomas

final JdbcConnectionPool pool =
    JdbcConnectionPool.create("jdbc:h2:mem:", "sa", "sa");
int len = 10;
Thread[] t = new Thread[len];
for (int i = 0; i < len; i++) {
    t[i] = new Thread(new Runnable() {
        public void run() {
            try {
                while (true) {
                    Connection conn = pool.getConnection();
                    conn.createStatement()
                        .execute("SELECT * FROM DUAL");
                    conn.close();
                }
            } catch (IllegalStateException e) {
                // expected after closing
            } catch (SQLException e) {
                e.printStackTrace();
            }
        }
    });
    t[i].start();
}
Thread.sleep(1000);
pool.dispose();
Thread.sleep(100);
for (int i = 0; i < len; i++) {
    t[i].join();
}

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

Reply via email to