sqlite-jdbc
sqlite-jdbc copied to clipboard
SQLitePooledConnection physical connection is exposed on statements
When a proxy connection returned by SQLitePooledConnection#getConnection() is used to create a statement, the underlying physical connection is exposed on the statement. I am using a third-party library which is creating a statement and then closing the connection when it finishes by using the reference on the statement, which leaves the pooled connection in an unusable state.
ConnectionPoolDataSource ds = new SQLiteConnectionPoolDataSource();
PooledConnection pooledConn = ds.getPooledConnection();
Connection handle = pooledConn.getConnection();
handle.createStatement().getConnection().close(); // This closes the physical connection, not the proxy
Connection handle2 = pooledConn.getConnection(); // java.sql.SQLException: database connection closed
Thanks for reporting. This makes sense since I observed the same issue when using HikariCP with sqlite-jdbc.
Is this still happening on the latest version?
Seems like it was actually closed by #340