I'm getting a whack of stack traces all at once that indicate my connections are not getting closed;org.h2.message.DbException: The connection was not closed by the application and is garbage collected [90018-167]at org.h2.message.DbException.get(DbException.java:169)at org.h2.message.DbException.get(DbException.java:146)at org.h2.message.DbException.get(DbException.java:135)at org.h2.jdbc.JdbcConnection.closeOld(JdbcConnection.java:174)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.JdbcDataSource.getJdbcConnection(JdbcDataSource.java:181)at org.h2.jdbcx.JdbcDataSource.getXAConnection(JdbcDataSource.java:315)at org.h2.jdbcx.JdbcDataSource.getPooledConnection(JdbcDataSource.java:341)However, I am closing my connections in finally blocks wherever I am using them:} finally {DbUtils.closeQuietly( conn, pstmt, rs );}My conn object is retrieved from a datasource and I'm using a pooled connection:conn = ( (JdbcDataSource)ds ).getPooledConnection().getConnection();
The code I'm running is scanning through a file and inserting records as it goes. As each record is inserted, the connection should be getting closed. I have verified the calls are made:07-19 12:55:47 jdbc[55]:/**/conn108.prepareStatement("INSERT INTO TABLE_X ( path, filename, lastTouched, createdTime ) VALUES( ?, ?, ?, ? )", 1);07-19 12:55:47 jdbc[55]:/**/PreparedStatement prep54 = conn108.prepareStatement("INSERT INTO TABLE_X ( path, filename, lastTouched, createdTime ) VALUES( ?, ?, ?, ? )");07-19 12:55:47 jdbc[55]:/**/prep54.setString(1, "/xxx");07-19 12:55:47 jdbc[55]:/**/prep54.setString(2, "xxxx.pdf");07-19 12:55:47 jdbc[55]:/**/prep54.setTimestamp(3, Timestamp.valueOf("2005-09-16 00:00:00.0"));07-19 12:55:47 jdbc[55]:/**/prep54.setTimestamp(4, Timestamp.valueOf("2012-07-19 12:55:47.848"));07-19 12:55:47 jdbc[55]:/**/prep54.executeUpdate();07-19 12:55:47 lock: 55 exclusive write lock requesting for TABLE_X07-19 12:55:47 lock: 55 exclusive write lock added for TABLE_X07-19 12:55:47 index: TABLE_X add ( /* key:27 */ 27, '/xxx', 'xxxx.pdf', TIMESTAMP '2005-09-16 00:00:00.0', TIMESTAMP '2012-07-19 12:55:47.848', NULL)07-19 12:55:47 pageStore: log + s: 55 table: 15 row: ( /* key:27 */ 27, '/xxx', 'xxxx.pdf', TIMESTAMP '2005-09-16 00:00:00.0', TIMESTAMP '2012-07-19 12:55:47.848', NULL)07-19 12:55:47 index: IDX_PATH add ( /* key:27 */ 27, '/xxx', 'xxxx.pdf', TIMESTAMP '2005-09-16 00:00:00.0', TIMESTAMP '2012-07-19 12:55:47.848', NULL)07-19 12:55:47 index: IDX_FILENAME add ( /* key:27 */ 27, '/xxx', 'xxxx.pdf', TIMESTAMP '2005-09-16 00:00:00.0', TIMESTAMP '2012-07-19 12:55:47.848', NULL)07-19 12:55:47 jdbc[55]:/*SQL l:101 #:1 t:1*/INSERT INTO TABLE_X ( path, filename, lastTouched, createdTime ) VALUES( ?, ?, ?, ? ) {1: '/xxx', 2: 'xxxx.pdf', 3: TIMESTAMP '2005-09-16 00:00:00.0', 4: TIMESTAMP '2012-07-19 12:55:47.848'};07-19 12:55:47 pageStore: log commit s: 5507-19 12:55:47 lock: 55 exclusive write lock unlock TABLE_X07-19 12:55:47 jdbc[55]:/**/ResultSet rs30 = prep54.getGeneratedKeys();07-19 12:55:47 jdbc[55]:/*SQL #:1*/SELECT SCOPE_IDENTITY() WHERE SCOPE_IDENTITY() IS NOT NULL;07-19 12:55:47 jdbc[55]:/**/rs30.next();07-19 12:55:47 jdbc[55]:/**/rs30.getLong(1);07-19 12:55:48 pageStore: pageOut.storePage [12] stream data key:2 pos:175 remaining:187307-19 13:31:49 jdbc[55]:/**/rs30.close();07-19 13:31:49 jdbc[55]:/**/prep54.close();07-19 13:31:49 jdbc[55]:/**/conn108.rollback();07-19 13:31:49 jdbc[55]:/*SQL */ROLLBACK;07-19 13:31:49 jdbc[55]:/**/conn108.setAutoCommit(true);So, it seems the connections are calling close(), yet they are not getting closed. Anyone seen this when running in embedded mode with a connection pool?Thanks.--
You received this message because you are subscribed to the Google Groups "H2 Database" group.
To view this discussion on the web visit https://groups.google.com/d/msg/h2-database/-/hJ9e7d153jMJ.
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.
Connection
method close. When connection pooling is being done, the connection
pool manager is notified because it has registered itself as a
ConnectionEventListener object using the
ConnectionPool method addConnectionEventListener. The
connection pool manager deactivates the handle to the
PooledConnection object and returns the
PooledConnection object to the pool of connections so that it can
be used again. Thus, when an application closes its connection, the underlying
physical connection is recycled rather than being closed..."--
You received this message because you are subscribed to the Google Groups "H2 Database" group.
To view this discussion on the web visit https://groups.google.com/d/msg/h2-database/-/jHzj91HFh2cJ.
--
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 http://groups.google.com/group/h2-database.
For more options, visit https://groups.google.com/d/optout.