Thread: Problems retrieving data from bytea field

Problems retrieving data from bytea field

From
"Iran"
Date:
Hi. I'm havnig a problem when try to retrieve binary data from a bytea
field where I'm storing na image (jpg).

First of all, my setup is, RedHat 8.0, PostgreSQL 7.3.2 and I'm trying
to access this data using the latest JDBC stable driver released (I
think) which is the pg73jdbc2.jar (I tried with pg73jdbc3.jar too).

The store process occurs nicely, but when I retrieve this data from
database, it comes corrupted and I invariably got more bytes than I
stored.

What am I missing here?

Thanx in advance.

iran


Re: Problems retrieving data from bytea field

From
Barry Lind
Date:
Iran,

This is a bug in the database server in 7.3.  The server is doing
character set translation on the binary data being returned to the jdbc
client.  This bug was reported a couple of months ago on the
pgsql-hackers mail list.  I don't know if it has been fixed yet.

thanks,
--Barry


Iran wrote:
> Hi. I'm havnig a problem when try to retrieve binary data from a bytea
> field where I'm storing na image (jpg).
>
> First of all, my setup is, RedHat 8.0, PostgreSQL 7.3.2 and I'm trying
> to access this data using the latest JDBC stable driver released (I
> think) which is the pg73jdbc2.jar (I tried with pg73jdbc3.jar too).
>
> The store process occurs nicely, but when I retrieve this data from
> database, it comes corrupted and I invariably got more bytes than I
> stored.
>
> What am I missing here?
>
> Thanx in advance.
>
> iran
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 2: you can get off all lists at once with the unregister command
>     (send "unregister YourEmailAddressHere" to majordomo@postgresql.org)
>


Re: Problems retrieving data from bytea field

From
"Dirk Bromberg"
Date:
You can take the pg72jdbc.jar, this works. (with postgres 7.3 and
bytea's).

Dirk




>-----Ursprüngliche Nachricht-----
>Von: pgsql-jdbc-owner@postgresql.org
>[mailto:pgsql-jdbc-owner@postgresql.org] Im Auftrag von Barry Lind
>Gesendet: Mittwoch, 9. April 2003 23:29
>An: Iran
>Cc: pgsql-jdbc@postgresql.org
>Betreff: Re: [JDBC] Problems retrieving data from bytea field
>
>
>Iran,
>
>This is a bug in the database server in 7.3.  The server is doing
>character set translation on the binary data being returned to
>the jdbc
>client.  This bug was reported a couple of months ago on the
>pgsql-hackers mail list.  I don't know if it has been fixed yet.
>
>thanks,
>--Barry
>
>
>Iran wrote:
>> Hi. I'm havnig a problem when try to retrieve binary data
>from a bytea
>> field where I'm storing na image (jpg).
>>
>> First of all, my setup is, RedHat 8.0, PostgreSQL 7.3.2 and
>I'm trying
>> to access this data using the latest JDBC stable driver released (I
>> think) which is the pg73jdbc2.jar (I tried with pg73jdbc3.jar too).
>>
>> The store process occurs nicely, but when I retrieve this data from
>> database, it comes corrupted and I invariably got more bytes than I
>> stored.
>>
>> What am I missing here?
>>
>> Thanx in advance.
>>
>> iran
>>
>>
>> ---------------------------(end of
>> broadcast)---------------------------
>> TIP 2: you can get off all lists at once with the unregister command
>>     (send "unregister YourEmailAddressHere" to
>majordomo@postgresql.org)
>>
>
>
>---------------------------(end of
>broadcast)---------------------------
>TIP 6: Have you searched our list archives?
>
>http://archives.postgresql.org
>
>


RES: Problems retrieving data from bytea field

From
"Iran"
Date:
Thanks for the information.

Do you remember exactly the url for the bug message? If don't, no need
to reply.

Thanx anyway.

iran

> -----Mensagem original-----
> De: pgsql-jdbc-owner@postgresql.org
> [mailto:pgsql-jdbc-owner@postgresql.org] Em nome de Barry Lind
> Enviada em: quarta-feira, 9 de abril de 2003 18:29
> Para: Iran
> Cc: pgsql-jdbc@postgresql.org
> Assunto: Re: [JDBC] Problems retrieving data from bytea field
>
>
> Iran,
>
> This is a bug in the database server in 7.3.  The server is doing
> character set translation on the binary data being returned
> to the jdbc
> client.  This bug was reported a couple of months ago on the
> pgsql-hackers mail list.  I don't know if it has been fixed yet.
>
> thanks,
> --Barry
>
>
> Iran wrote:
> > Hi. I'm havnig a problem when try to retrieve binary data
> from a bytea
> > field where I'm storing na image (jpg).
> >
> > First of all, my setup is, RedHat 8.0, PostgreSQL 7.3.2 and
> I'm trying
> > to access this data using the latest JDBC stable driver released (I
> > think) which is the pg73jdbc2.jar (I tried with pg73jdbc3.jar too).
> >
> > The store process occurs nicely, but when I retrieve this data from
> > database, it comes corrupted and I invariably got more bytes than I
> > stored.
> >
> > What am I missing here?
> >
> > Thanx in advance.
> >
> > iran
> >
> >
> > ---------------------------(end of
> broadcast)---------------------------
> > TIP 2: you can get off all lists at once with the unregister command
> >     (send "unregister YourEmailAddressHere" to
> majordomo@postgresql.org)
> >
>
>
> ---------------------------(end of
> broadcast)---------------------------
> TIP 6: Have you searched our list archives?
>
http://archives.postgresql.org


RES: Problems retrieving data from bytea field

From
"Iran"
Date:
By the way, I've tested pg72jdbc2.jar in place of pg73jdbc2.jar, with
tha same PG version (7.3.2) and evething works fine. I was able to
perfectly retrieve my stored image.

So, is the bug in server really? Because, for me, it looks like a "miss
decoding" issue in pg73jdbc2.jar.

iran

> -----Mensagem original-----
> De: pgsql-jdbc-owner@postgresql.org
> [mailto:pgsql-jdbc-owner@postgresql.org] Em nome de Barry Lind
> Enviada em: quarta-feira, 9 de abril de 2003 18:29
> Para: Iran
> Cc: pgsql-jdbc@postgresql.org
> Assunto: Re: [JDBC] Problems retrieving data from bytea field
>
>
> Iran,
>
> This is a bug in the database server in 7.3.  The server is doing
> character set translation on the binary data being returned
> to the jdbc
> client.  This bug was reported a couple of months ago on the
> pgsql-hackers mail list.  I don't know if it has been fixed yet.
>
> thanks,
> --Barry
>
>
> Iran wrote:
> > Hi. I'm havnig a problem when try to retrieve binary data
> from a bytea
> > field where I'm storing na image (jpg).
> >
> > First of all, my setup is, RedHat 8.0, PostgreSQL 7.3.2 and
> I'm trying
> > to access this data using the latest JDBC stable driver released (I
> > think) which is the pg73jdbc2.jar (I tried with pg73jdbc3.jar too).
> >
> > The store process occurs nicely, but when I retrieve this data from
> > database, it comes corrupted and I invariably got more bytes than I
> > stored.
> >
> > What am I missing here?
> >
> > Thanx in advance.
> >
> > iran
> >
> >
> > ---------------------------(end of
> broadcast)---------------------------
> > TIP 2: you can get off all lists at once with the unregister command
> >     (send "unregister YourEmailAddressHere" to
> majordomo@postgresql.org)
> >
>
>
> ---------------------------(end of
> broadcast)---------------------------
> TIP 6: Have you searched our list archives?
>
http://archives.postgresql.org


Re: RES: Problems retrieving data from bytea field

From
Barry Lind
Date:
Iran,

In 7.2 the jdbc driver does the character set translation.  But for
performance reasons this was changed in 7.3 to have the server do
character set translation.  That is why it works for you with the 7.2
driver but not the 7.3 driver.  But the underlying problem is still a
server bug.  No it is true that the driver could work around the bug by
reverting to the 7.2 behavior, but I would rather have resources spent
on fixing the bug, than doing workarounds.

thanks,
--Barry


Iran wrote:
> By the way, I've tested pg72jdbc2.jar in place of pg73jdbc2.jar, with
> tha same PG version (7.3.2) and evething works fine. I was able to
> perfectly retrieve my stored image.
>
> So, is the bug in server really? Because, for me, it looks like a "miss
> decoding" issue in pg73jdbc2.jar.
>
> iran
>
>
>>-----Mensagem original-----
>>De: pgsql-jdbc-owner@postgresql.org
>>[mailto:pgsql-jdbc-owner@postgresql.org] Em nome de Barry Lind
>>Enviada em: quarta-feira, 9 de abril de 2003 18:29
>>Para: Iran
>>Cc: pgsql-jdbc@postgresql.org
>>Assunto: Re: [JDBC] Problems retrieving data from bytea field
>>
>>
>>Iran,
>>
>>This is a bug in the database server in 7.3.  The server is doing
>>character set translation on the binary data being returned
>>to the jdbc
>>client.  This bug was reported a couple of months ago on the
>>pgsql-hackers mail list.  I don't know if it has been fixed yet.
>>
>>thanks,
>>--Barry
>>
>>
>>Iran wrote:
>>
>>>Hi. I'm havnig a problem when try to retrieve binary data
>>
>>from a bytea
>>
>>>field where I'm storing na image (jpg).
>>>
>>>First of all, my setup is, RedHat 8.0, PostgreSQL 7.3.2 and
>>
>>I'm trying
>>
>>>to access this data using the latest JDBC stable driver released (I
>>>think) which is the pg73jdbc2.jar (I tried with pg73jdbc3.jar too).
>>>
>>>The store process occurs nicely, but when I retrieve this data from
>>>database, it comes corrupted and I invariably got more bytes than I
>>>stored.
>>>
>>>What am I missing here?
>>>
>>>Thanx in advance.
>>>
>>>iran
>>>
>>>
>>>---------------------------(end of
>>
>>broadcast)---------------------------
>>
>>>TIP 2: you can get off all lists at once with the unregister command
>>>    (send "unregister YourEmailAddressHere" to
>>
>>majordomo@postgresql.org)
>>
>>
>>---------------------------(end of
>>broadcast)---------------------------
>>TIP 6: Have you searched our list archives?
>>
>
> http://archives.postgresql.org
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 2: you can get off all lists at once with the unregister command
>     (send "unregister YourEmailAddressHere" to majordomo@postgresql.org)
>