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

Re: Strange error when using varbit

From: Oliver Jowett <oliver(at)opencloud(dot)com>
To: Maciej Jaźwiński <maciejjazwinski(at)interia(dot)pl>
Cc: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: Strange error when using varbit
Date: 2005-08-22 05:07:18
Message-ID: (view raw, whole thread or download thread mbox)
Lists: 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 and


In response to

pgsql-jdbc by date

Next:From: Kris JurkaDate: 2005-08-22 06:07:26
Subject: Re: Czech translation
Previous:From: Petr DittrichDate: 2005-08-21 19:12:41
Subject: Czech translation

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