X-Original-To: pgsql-jdbc-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 6C571535A2 for ; Thu, 12 May 2005 14:30:20 -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 86427-04 for ; Thu, 12 May 2005 17:30:17 +0000 (GMT) Received: from mail.refractions.net (mail.refractions.net [24.68.236.214]) by svr1.postgresql.org (Postfix) with ESMTP id 158FE533C3 for ; Thu, 12 May 2005 14:30:14 -0300 (ADT) Received: from 192.168.50.92 (unknown [192.168.50.92]) by mail.refractions.net (Postfix) with ESMTP id C8F8E122C2D3; Thu, 12 May 2005 10:40:03 -0700 (PDT) Subject: Re: bytea encoding From: Jesse To: Oliver Jowett Cc: pgsql-jdbc@postgresql.org In-Reply-To: <42827EBC.5070707@opencloud.com> References: <1115843849.5221.28.camel@weasel> <42827EBC.5070707@opencloud.com> Content-Type: text/plain Date: Thu, 12 May 2005 10:31:59 -0700 Message-Id: <1115919119.4902.7.camel@weasel> Mime-Version: 1.0 X-Mailer: Evolution 2.0.2 (2.0.2-3) Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.07 tagged_above=0 required=5 tests=AWL, DNS_FROM_AHBL_RHSBL X-Spam-Level: X-Archive-Number: 200505/64 X-Sequence-Number: 12895 My problem is this: I want to send a binary file in a CDATA section of an xml file to a server that will then turn around and put the binary file a bytea column. Is there a way that I can use postgresql-74.213.jar (or more recent) to encode the file in bytea on the client side? If no, do you know where I can get code to do that? If the server puts data in the database will the database recognize that it is bytea already? thank you, Jesse On Thu, 2005-05-12 at 09:53 +1200, Oliver Jowett wrote: > Jesse Eichar wrote: > > > 1. Is the byte stream (or byte array) converted to bytea on the database > > side or on client before sending? (My client is using the > > postgresql-74.213.jar). > > You give the driver a byte[] (setBytes) or InputStream > (setBinaryStream); it does the rest. Old drivers such as build 213 will, > IIRC, convert this to a text representation internally before sending to > the backend; newer drivers will send the data directly without > conversion. But this is all transparent to the client. > > -O