bytea problem

Поиск
Список
Период
Сортировка
От alkampfer
Тема bytea problem
Дата
Msg-id 1321983450992-5014176.post@n5.nabble.com
обсуждение исходный текст
Ответы Re: bytea problem
Список pgsql-jdbc
Hello, this is my problem :
I use java + postgres and I want to store image files into a table

my table : (id int,  image bytea)

the code :
                byte bytes[] = new byte[(int)file.length()];

                sqlq ="UPDATE table set image= ? where id=?";
                ps = .....prepareStatement(sqlq);
                ps.setBytes(2,bytes);
                ps.setString(2,id);

put the file into my table, stream of 41054 bytes, OK.

but when I retrieve it from the database resultSet.getBytes("image") gives
an array of 82108 bytes!!
worst of all those bytes I get have no sense at all, like 00 00  00 or 11
11....

thanks for the help!




--
View this message in context: http://postgresql.1045698.n5.nabble.com/bytea-problem-tp5014176p5014176.html
Sent from the PostgreSQL - jdbc mailing list archive at Nabble.com.

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

Предыдущее
От: Stevo Slavić
Дата:
Сообщение: Re: Publish 9.1-901 JDBC drivers on maven central
Следующее
От: "Mikael"
Дата:
Сообщение: Re: bytea problem