X-Original-To: pgsql-jdbc-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id F2A7CD6D76 for ; Mon, 22 Aug 2005 02:07:29 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 48614-05 for ; Mon, 22 Aug 2005 05:07:25 +0000 (GMT) Received: from yass.opencloud.co.nz (yass.opencloud.co.nz [203.79.85.162]) by svr1.postgresql.org (Postfix) with ESMTP id 26470D6D04 for ; Mon, 22 Aug 2005 02:07:23 -0300 (ADT) Received: from 203-79-104-60.cable.paradise.net.nz ([203.79.104.60] helo=[192.168.0.20]) by yass.opencloud.co.nz with asmtp (TLS-1.0:DHE_RSA_AES_128_CBC_SHA:16) (Exim 4.34) id 1E74Wo-0007qc-Ht; Mon, 22 Aug 2005 17:07:22 +1200 Message-ID: <43095D86.8060106@opencloud.com> Date: Mon, 22 Aug 2005 17:07:18 +1200 From: Oliver Jowett User-Agent: Mozilla Thunderbird 1.0.2 (X11/20050324) X-Accept-Language: en-us, en MIME-Version: 1.0 To: =?ISO-8859-2?Q?Maciej_Ja=BCwi=F1ski?= Cc: pgsql-jdbc@postgresql.org Subject: Re: Strange error when using varbit References: <001401c5a54b$efe43d90$6302040a@javaone> In-Reply-To: <001401c5a54b$efe43d90$6302040a@javaone> X-Enigmail-Version: 0.90.2.0 X-Enigmail-Supports: pgp-inline, pgp-mime Content-Type: text/plain; charset=ISO-8859-2 Content-Transfer-Encoding: 8bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.008 required=5 tests=[AWL=0.008] X-Spam-Level: X-Archive-Number: 200508/163 X-Sequence-Number: 13732 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