From: Tilman Sandig <info@sandig.com>
To: pgsql-jdbc@postgresql.org
Subject: JDBC 9.2: multiple execution of prepared statement-query delivers different double precision results via getString()
Date: Fri, 13 Sep 2013 17:44:44 +0200
Message-ID: <004201ceb098$2d6d79f0$88486dd0$@com> (raw)
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-jdbc>
Hello,
there might be a problem in the latest JDBC-driver (9.2 build 1003) when querying double precision-result columns multiple times
and retrieving the result with ResultSet.getString():
The first five queries work as expected, further calls append ".0" to the result-string.
Here is a sample code:
PreparedStatement stmt = myConnection.prepareStatement("select cast(1 as double precision)");
for (int x=0;x<12;x++){
ResultSet rs = stmt.executeQuery();
while (rs.next()){
System.out.println("Value: " + rs.getString(1));
}
}
-------
Output:
-------
Value: 1
Value: 1
Value: 1
Value: 1
Value: 1
Value: 1.0
Value: 1.0
Value: 1.0
Value: 1.0
Value: 1.0
Value: 1.0
Value: 1.0
The problem does not occur when using JDBC-driver version 9.1;
I use PostgreSQL Version 9.3.0 (Win64/Vista)
Best regards,
Tilman Sandig
--
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: info@sandig.com
Subject: Re: JDBC 9.2: multiple execution of prepared statement-query delivers different double precision results via getString()
In-Reply-To: <004201ceb098$2d6d79f0$88486dd0$@com>
References: <004201ceb098$2d6d79f0$88486dd0$@com>
* 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