PreparedStatment.setBinaryStream()

From: "Brian Jordan" <bjordan(at)ie3ventures(dot)com>
To: <pgsql-jdbc(at)postgresql(dot)org>
Subject: PreparedStatment.setBinaryStream()
Date: 2001-05-24 17:48:30
Message-ID: OLEMLCFKHJJDEPCKDOANEEHNCBAA.bjordan@ie3ventures.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

I was wondering if anyone had any insight to a problem I am having with the
setBinaryStream() function call. I am using Postgresql 7.1.1 running under
Win 2000 via the Cygnus environment. The JDBC driver is also version 7.1.1
(Enterprise) successfully compiled from the latest source available via
postgresql.org. I am using JDK 1.3.1.

I am attempting to place binary data into the database to include images and
serialized data. I ran through the image and blob tests in the "example"
package for the driver and was able to successfully insert and remove images
and blobs from the database. However, I am unable to insert binary data
into the database via the setBinaryStream() function. I am required to use
this method because a third-party component uses this method and I have no
way to alter the code.

I have traced the problem through to the
org.postgresql.fastpath.Fastpath.fastpath() method. When the stream that is
created in PreparedStatement.setBinaryStream() is closed, the

fastpath(int fnid,boolean resulttype,FastpathArg[] args)

method gets called to execute the lo_write function that writes the data
into the database of the pg_largeobject table and write the OID into my
table as a pointer to the data. When this occurs, the backend returns 69 to
indicate an error and the fastpath() method throws an exception --

// Error message returned
case 'E':
throw new
PSQLException("postgresql.fp.error",stream.ReceiveString(4096));

The debug output from the console where Postgresql is running displays the
following:

lo_write: invalid large object descriptor (0)

Is there something that I am missing here or is this a bug? Really
appreciate any thoughts on what is causing the problem and how to correct
it.

Finally, does anyone know where I can pull down the very latest version of
the patched source code? I see references in the discussion to patches
being applied and wanted to make sure that I had them to update the source
or get the latest patched source.

Thanks

Brian Jordan

Attachment Content-Type Size
winmail.dat application/ms-tnef 4.5 KB

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Bruce Momjian 2001-05-24 20:42:33 Re: PreparedStatment.setBinaryStream()
Previous Message Bruce Momjian 2001-05-24 15:48:57 Re: Patches for Serialize.java