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.