Re: java.sql.Statement.isClosed() throws an SQLException if the statement is closed

From: Dave Cramer <pg(at)fastcrypt(dot)com>
To: Christian Schlichtherle <christian(at)schlichtherle(dot)de>
Cc: List <pgsql-jdbc(at)postgresql(dot)org>
Subject: Re: java.sql.Statement.isClosed() throws an SQLException if the statement is closed
Date: 2014-08-18 12:29:54
Message-ID: CADK3HHL7kGrQ0ZMo1S71Koe82BApe2tkh_-AB+Xv4+azKVtH9Q@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

Do you have a patch ?

Dave Cramer

dave.cramer(at)credativ(dot)ca
http://www.credativ.ca

On 15 August 2014 11:36, Christian Schlichtherle <christian(at)schlichtherle(dot)de
> wrote:

> The bug likewise applies to PreparedStatement, not just Statement.
>
> Am 15.08.2014 um 13:43 schrieb Christian Schlichtherle <
> christian(at)schlichtherle(dot)de>:
>
> > 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
>
>

In response to

Browse pgsql-jdbc by date

  From Date Subject
Next Message Christopher Barham 2014-08-18 13:18:35 JDBC documentation - issue report
Previous Message Christian Schlichtherle 2014-08-17 06:56:05 Re: Can't build