From: | Christian Schlichtherle <christian(at)schlichtherle(dot)de> |
---|---|
To: | pgsql-jdbc(at)postgresql(dot)org |
Subject: | java.sql.Statement.isClosed() throws an SQLException if the statement is closed |
Date: | 2014-08-15 11:43:05 |
Message-ID: | 6E4A59F2-59FA-4751-B8D9-66832BE1FF84@schlichtherle.de |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-jdbc |
Hi,
this bug applies to the JDBC driver version 9.3-1102-jdbc41. It only happens when using a PGPoolingDataSource. The bug is in the proxy class for the Statement. Here’s some test code to provide evidence:
<pre><code>
package cpssd.postgresql;
import org.junit.Test;
import org.postgresql.ds.PGPoolingDataSource;
import java.sql.Connection;
import java.sql.SQLException;
import java.sql.Statement;
public class IsClosedIT {
@Test(expected = SQLException.class)
public void testIsClosed() throws SQLException {
final PGPoolingDataSource ds = new PGPoolingDataSource();
ds.setDatabaseName("postgres");
try (Connection c = ds.getConnection()) {
Statement s = c.createStatement();
s.close();
// Throws SQLException: Statement has been closed.
assert s.isClosed();
}
}
}
</code></pre>
Regards,
Christian Schlichtherle
From | Date | Subject | |
---|---|---|---|
Next Message | Barry Bell | 2014-08-15 12:45:58 | Re: [ODBC] BIRT report opening multiple connections |
Previous Message | Craig Ringer | 2014-08-15 09:17:36 | Re: [ODBC] BIRT report opening multiple connections |