Skip site navigation (1) Skip section navigation (2)

Re: PreparedStatment.setBinaryStream()

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: bjordan(at)ie3ventures(dot)com
Cc: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: PreparedStatment.setBinaryStream()
Date: 2001-05-24 20:42:33
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-jdbc
Yes, known bug, fixed in current cvs.  Jar files at:

[ 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
>  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(at)postgresql(dot)org)

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

In response to

pgsql-jdbc by date

Next:From: vivek kheraDate: 2001-05-25 09:26:19
Previous:From: Brian JordanDate: 2001-05-24 17:48:30
Subject: PreparedStatment.setBinaryStream()

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group