Обсуждение: Re: JDBC driver inserting into a table with Bytea type get

Поиск
Список
Период
Сортировка

Re: JDBC driver inserting into a table with Bytea type get

От
"Sailer, Denis (YBUSA-CDR)"
Дата:
Yes, there is talk of a patch going into CVS, but there isn't anything that
says "here it is".  Is there a patch in CVS and would someone post the
procedure for getting it out?

I don't see how this is a missing feature.  The documentation clearly states
that bytea can hold up to 1GB of data.  Isn't it fair to assume that each
interface that can be used to insert that data would work correctly?

Wouldn't the regression tests that get performed as part of each version
rollout catch this kind of error?  Binary data is so common in databases
these days.

If you couldn't tell by the questions, we are attempting to convert several
Oracle and DB2 databases to PostgreSQL.  The storage of documents is
critical to getting this done.  Up to this point my only worry was how to
deal with no point in time recovery.  I kind of expected basic functionality
to just work.


-----Original Message-----
From: Kris Jurka [mailto:books@ejurka.com]
Sent: Monday, June 21, 2004 2:02 PM
To: Sailer, Denis (YBUSA-CDR)
Cc: 'pgsql-jdbc@postgresql.org'
Subject: Re: [JDBC] JDBC driver inserting into a table with Bytea type gets
out of me mory error.



On Mon, 21 Jun 2004, Sailer, Denis (YBUSA-CDR) wrote:

> This person was getting out of memory conditions inserting rows when the
> data in the bytea field was larger than approx.  1400 Kb.  This person had
> posted a fix to the group that seemed to work for him.  The inserts were
> coming from a java application using the JDBC driver.
> I just tried the latest JDBC driver and the problem still exists.
> Is this issue acknowledged as a bug?

It is more of a missing feature, "the ability to stream large data to the
backend."

> If yes, when is this issue going to be implemented in the code base?

There is an outstanding patch by Oliver Jowett, but I have some concerns
about how it handles errror conditions (it will just drop the connection
in some cases.)

> If it is already fixed, what are the steps to implement the changes to my
> 7.4.2 installation?  Build my own JDBC driver?

When/if it is applied it will go only into the 7.5 source tree so you can
use that against your 7.4 server, but for the moment your only option is
to build your own version of the driver.

The original patch/discussion is here:

http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&c2coff=1&safe=off&threadm
=Pine.BSO.4.56.0405251012470.21539%40leary.csoft.net&rnum=1&prev=/&frame=on

Kris Jurka

Re: JDBC driver inserting into a table with Bytea type get

От
Kris Jurka
Дата:

On Mon, 21 Jun 2004, Sailer, Denis (YBUSA-CDR) wrote:

> Yes, there is talk of a patch going into CVS, but there isn't anything that
> says "here it is".  Is there a patch in CVS and would someone post the
> procedure for getting it out?

It is not in cvs.  It is the first post in this long thread.  Specifically
this one:

http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&c2coff=1&safe=off&selm=4085F25A.8060009%40opencloud.com

> I don't see how this is a missing feature.  The documentation clearly states
> that bytea can hold up to 1GB of data.  Isn't it fair to assume that each
> interface that can be used to insert that data would work correctly?

This will work correctly if you have adequate memory settings for the JVM.
In reality not many have that amount of memory handy.  For example calling
PreparedStatement.setBytes() with a 1GB byte array requires at least 1GB
of memory and there's no getting around that.  The driver then does some
escaping and so on which takes additional memory.  The goal of this patch
is to reduce this additional overhead, but there's no way (even with the
patch) that you can have a 1GB byte array with the default JVM settings.
The patch allows setBinaryStream to directly stream binary data which
should get rid of out of memory errors, but it's not as friendly an
interface.

Kris Jurka