Re: PreparedStatment.setBinaryStream() - Mailing list pgsql-jdbc

From Bruce Momjian
Subject Re: PreparedStatment.setBinaryStream()
Date
Msg-id 200105242042.f4OKgXr29231@candle.pha.pa.us
Whole thread Raw
In response to PreparedStatment.setBinaryStream()  ("Brian Jordan" <bjordan@ie3ventures.com>)
List pgsql-jdbc
Yes, known bug, fixed in current cvs.  Jar files at:

    http://jdbc.fastcrypt.com


[ Charset ISO-8859-1 unsupported, converting... ]
> 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, skipping... ]

>
> ---------------------------(end of broadcast)---------------------------
> TIP 2: you can get off all lists at once with the unregister command
>     (send "unregister YourEmailAddressHere" to majordomo@postgresql.org)

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026

pgsql-jdbc by date:

Previous
From: "Brian Jordan"
Date:
Subject: PreparedStatment.setBinaryStream()
Next
From: Ken K
Date:
Subject: Serialized data type for the Serialize code