Re: Fwd: Large Objects (please help)

From: Dave Harkness <daveh(at)MEconomy(dot)com>
To: pgsql-jdbc(at)postgresql(dot)org
Cc: Brian Buck <bbuck(at)dimensional(dot)com>
Subject: Re: Fwd: Large Objects (please help)
Date: 2001-10-08 19:07:01
Message-ID: 5.1.0.14.2.20011008115344.00aca198@mail.meconomy.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Browse pgsql-jdbc by date

  From Date Subject
Next Message Dave Cramer 2001-10-08 21:31:30 Re: [Fwd: Re: Serialize]
Previous Message Peter T Mount 2001-10-08 14:03:47 Fwd: Large Objects (please help)