Re: Strange error using postgres 8.2 + JDBC 8.2 driver

Поиск
Список
Период
Сортировка
От Csaba Nagy
Тема Re: Strange error using postgres 8.2 + JDBC 8.2 driver
Дата
Msg-id 1169054662.22307.305.camel@coppola.muc.ecircle.de
обсуждение исходный текст
Ответ на Re: Strange error using postgres 8.2 + JDBC 8.2 driver  (Csaba Nagy <nagy@ecircle-ag.com>)
Список 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.



В списке pgsql-jdbc по дате отправления:

Предыдущее
От: Kris Jurka
Дата:
Сообщение: Re: Strange error using postgres 8.2 + JDBC 8.2 driver
Следующее
От: "Guillaume Smet"
Дата:
Сообщение: Memory leaks using refcursors