Re: Strange error when using varbit
От | Oliver Jowett |
---|---|
Тема | Re: Strange error when using varbit |
Дата | |
Msg-id | 43095D86.8060106@opencloud.com обсуждение исходный текст |
Ответ на | Strange error when using varbit (Maciej Jaźwiński <maciejjazwinski@interia.pl>) |
Список | pgsql-jdbc |
Maciej Jaźwiński wrote: > I have a problem with varbit and blobs. I need to upload binary files to > my database, and yesterday I've got it working.... for an hour or two. > Files were uploaded, but image (which I tried to download then was > corrupted). But the worst came later, postgres started to throw > exceptions at me :( Help, this is part of my diploma, and i really need > to get it working.. > org.postgresql.util.PSQLException: ERROR: "%" is not a valid binary digit > String update = "insert into resources (resources_id, projects_id, > requirements_id, " + > "filename, content_type, filesize, file) values (?, ?, ?, ?, ?, ?, ?)"; What is the definition of the 'resources' table? I suspect from your description and the error that you are getting confused between bit(n) (bit string) and bytea (binary data). For your application it sounds like you want to use bytea. There's no direct mapping of bit(n) types in JDBC. See http://www.postgresql.org/docs/8.0/static/datatype-binary.html and http://www.postgresql.org/docs/8.0/static/datatype-bit.html. -O
В списке pgsql-jdbc по дате отправления: