Hi,

my trace file contains some "connection not closed" warnings:

08-29 07:06:13 jdbc[4]: connection not closed
java.lang.Exception: Stack Trace
        at org.h2.jdbc.JdbcConnection.<init>(JdbcConnection.java:121)
        at org.h2.jdbc.JdbcConnection.<init>(JdbcConnection.java:94)
        at org.h2.Driver.connect(Driver.java:72)
        at org.h2.jdbcx.JdbcXAConnection.<init>(JdbcXAConnection.java:77)
        at org.h2.jdbcx.JdbcDataSource.getXAConnection(JdbcDataSource.java:
311)
        at
org.h2.jdbcx.JdbcDataSource.getPooledConnection(JdbcDataSource.java:
341)
        at
org.h2.jdbcx.JdbcConnectionPool.getConnectionNow(JdbcConnectionPool.java:
222)
        at
org.h2.jdbcx.JdbcConnectionPool.getConnection(JdbcConnectionPool.java:
202)
        <my source code stack trace>

I tried to check why my application does not close the connections but
didn't really find anything (I am quite sure I've looked at the wrong
place ;-).

Now I have some questions:

1. Is it correct that the stack trace of the error message shows the
stack trace of the time when the unclosed connection was opened?

2. When and how does H2 detect that a connection from a connection
pool is not closed?

3. Sometimes my application closes and reopens the database. Do I have
to call the dispose method of the old JDBCConnectionPool? I haven't
done that because it's not part of the DataSource interface.
So the schematic code looks like:

  DataSource pool = JdbcConnectionPool.create(url, user, password);
  ... do lots of things ...
  ... ensure that no more connections are open  ...
  ... close the database using a "SHUTDOWN" command ...

  // do I have to call?
  // ((JDBCConnectionPool)pool).dispose();
  pool = null;

  pool = JdbcConnectionPool.create(url, user, password);


Uli

-- 
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