Skip site navigation (1) Skip section navigation (2)

Re: Strange error using postgres 8.2 + JDBC 8.2 driver

From: Csaba Nagy <nagy(at)ecircle-ag(dot)com>
To: Kris Jurka <books(at)ejurka(dot)com>
Cc: Postgres JDBC <pgsql-jdbc(at)postgresql(dot)org>
Subject: Re: Strange error using postgres 8.2 + JDBC 8.2 driver
Date: 2007-01-17 17:24:22
Message-ID: 1169054662.22307.305.camel@coppola.muc.ecircle.de (view raw or flat)
Thread:
Lists: pgsql-jdbc
On Wed, 2007-01-17 at 18:13, Csaba Nagy wrote:
> > This will actually happen in 8.1 servers if you are running the latest 
> > releases.  Previously, inserting something like "a\0b" would silently 
> > truncate at the null byte, but now it's an error.  So, check your data for 
> > \0.

OK, I was able to reproduce it using:

Connection connection = getConnection();
Statement statement = connection.createStatement();
statement.execute("create table test_null_in_string (data text)");
PreparedStatement prepStatement =
  connection.prepareStatement("insert into test_null_in_string values
(?)");
String test = new String(new byte[] {1, 2, 3, 0, 1, 2, 3}, "US-ASCII");
prepStatement.setString(1, test);
// will throw exception
prepStatement.executeUpdate();


So it is easily possible... now I have to check how it happens in our
system, but I'm afraid I won't like the implications :-/

Cheers,
Csaba.



In response to

pgsql-jdbc by date

Next:From: Guillaume SmetDate: 2007-01-17 18:53:21
Subject: Memory leaks using refcursors
Previous:From: Kris JurkaDate: 2007-01-17 17:20:04
Subject: Re: Strange error using postgres 8.2 + JDBC 8.2 driver

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group