Subject: [Pljava-dev] char with trailing space, PreparedStatement.setObject & SetString
Date: Tue, 27 Jun 2006 11:27:25 -0400
Message-ID: <BAY16-F122D445F6E3BA71358D5CA957E0@phx.gbl> (raw)
Hi,
Trailing space are not handled properly by setObject & setString.
PreparedStatement pstmt = connection.prepareStatement(
"select * from mytable where mycharcolumn = ?");
String myString = "abc ";
pstmt.setObject(1, myString); // or setObject(1, myString, Types.CHAR) or
setString(1, myString)
No rows are returned, but using trim works fine as in:
pstmt.setObject(1, myString.trim());
My environment is Pl/Java 1.3, Sun JDK 1.5.07, PostgreSQL 8.1.4, Windows XP
SP2
With PostgreSQL own (non pl/java) jdbc driver, setObject on char works fine
without the trim.
Thanks,
Jean-Pierre Pelletier
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 using the --to and --cc options:
reply via email
To: pljava-dev@postgresql.org
Subject: Re: [Pljava-dev] char with trailing space, PreparedStatement.setObject & SetString
In-Reply-To: <BAY16-F122D445F6E3BA71358D5CA957E0@phx.gbl>
* 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