Re: binary data - Mailing list pgsql-jdbc

From Uwe Kubosch
Subject Re: binary data
Date
Msg-id CHECLDNPGHELOIINBBLEKEEKEIAA.donv@crusaders.no
Whole thread Raw
In response to Re: binary data  (Anders Hermansen <anders@yoyo.no>)
Responses Testcase for bytea datatype
List pgsql-jdbc
> Can you try the following? Maybe the result slipped through the driver
> without being decoded?
>
> // I think this will work because the is is a ByteArrayInputStream
> byte[] buffer = new byte[is.available()];
> is.read(buffer);
>
> byte[] buffer2 = org.postgresql.util.PGbytea.toBytes(buffer);
>
> response.getOutputStream().write(buffer2, 0, buffer2.length);
> response.getOutputStream().flush();
> is.close();

OK, tried it.  buffer is 5527 bytes.  The PGbytea.toBytes(buffer) call
returned an array of size 5485.  Original file size was 4342 bytes.


Uwe


pgsql-jdbc by date:

Previous
From: Anders Hermansen
Date:
Subject: Re: binary data
Next
From: Dave Cramer
Date:
Subject: Re: postgreSQL dirver compatibility to Oracle DB