Re: Fwd: Large Objects (please help) - Mailing list pgsql-jdbc

From Dave Harkness
Subject Re: Fwd: Large Objects (please help)
Date
Msg-id 5.1.0.14.2.20011008115344.00aca198@mail.meconomy.com
Whole thread Raw
In response to Fwd: Large Objects (please help)  (Peter T Mount <peter@retep.org.uk>)
List pgsql-jdbc
Hi Brian,

At 07:03 AM 10/8/2001, you wrote:
>>I am trying to insert and/or select from Postgres a gif image by using
>>the Large Object type. ...
>>
>>The first statement [ps.setBinaryStream(2,fis, file.length())] produces a
>>compile time error :
>>
>>main.java:70: setBinaryStream(int,java.io.InputStream,int) in
>>java.sql.PreparedStatement cannot be applied to
>>(int,java.io.FileInputStream,long)
>>   ps.setBinaryStream(2,fis, file.length());
>>
>>The JDBC API confuses me a little.  Why doesn't the JDBC interface
>>define a long for this argument?  After all, we are dealing with big
>>byte streams.  Hmm.

I don't know, but that's a JDBC issue. Have you tried simply casting the
long to an int? I'm using the same code as you and it works. The next
problem you're sure to encounter is an invalid OID value (0). This is
caused by trying to access large objects outside of a transaction. I assume
you aren't using transactions since I don't see a "conn.commit()" after the
executeUpdate() call.

>>Maybe I have an old version of your driver.
>>
>>jdbc7.0-1.2.jar

Yes indeed. 7.1 is the latest stable release driver, and 7.2 is in development.

Peace,
Dave


pgsql-jdbc by date:

Previous
From: Peter T Mount
Date:
Subject: Fwd: Large Objects (please help)
Next
From: "Dave Cramer"
Date:
Subject: Re: [Fwd: Re: Serialize]