From: Glenn Holmer <shadowm@lyonlabs.org>
To: pgsql-jdbc@postgresql.org
Subject: Re: Statement.ececuteUpdate() closes ResultSet obtained from same Statement
Date: Sun, 24 Aug 2014 09:50:11 -0500
Message-ID: <53F9FBA3.8010109@lyonlabs.org> (raw)
In-Reply-To: <C49EB260-863F-4173-A215-69E8FC0ED18E@schlichtherle.de>
References: <C49EB260-863F-4173-A215-69E8FC0ED18E@schlichtherle.de>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-jdbc>
On 08/24/2014 07:33 AM, Christian Schlichtherle wrote:
> I am not sure if this is a bug or a feature, but here it goes:
> @Test(expected = SQLException.class)
> public void testSharedStatementClosesResultSet() throws SQLException {
> try (Connection c = getConnection();
> Statement s = c.createStatement()) {
> try (ResultSet rs = s.executeQuery("SELECT a FROM test")) {
> s.executeUpdate("INSERT INTO test(a) VALUES (1)");
> // Expected false, but throws SQLException: This statement has been closed.
> assert !rs.next();
> }
> }
> }
http://docs.oracle.com/javase/7/docs/api/java/sql/Statement.html
"All execution methods in the Statement interface implicitly close a
statment's current ResultSet object if an open one exists."
--
Glenn Holmer (Linux registered user #16682)
"After the vintage season came the aftermath -- and Cenbe."
--
Sent via pgsql-jdbc mailing list (pgsql-jdbc@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-jdbc
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-jdbc@postgresql.org
Cc: shadowm@lyonlabs.org
Subject: Re: Statement.ececuteUpdate() closes ResultSet obtained from same Statement
In-Reply-To: <53F9FBA3.8010109@lyonlabs.org>
References: <C49EB260-863F-4173-A215-69E8FC0ED18E@schlichtherle.de> <53F9FBA3.8010109@lyonlabs.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox