JDBC Interface Using Large Objects - Mailing list pgsql-interfaces

From tjm2@mail.ikasths.dk (Troels Jegbjaerg Moerch)
Subject JDBC Interface Using Large Objects
Date
Msg-id 002901c02921$500af990$97bfedd4@pc4151
Whole thread Raw
List pgsql-interfaces
Hi
 
I am using the JDBC 7.0-1.2 driver, PostgreSQL 7.02 Database and JDK 1.3 on Linux Red Hat 7.0. Almost everything works great. But when I am trying to insert a file into my postgresql database I get this error:
 
SQLException: InputStream as parameter not supported
Here is my code:
 
   File file = new File(theFile);
   FileInputStream fis = new FileInputStream(file);

   PreparedStatement ps = con.prepareStatement("insert into music(ID,
BinaryData) values (?,?)");
   ps.setString(1,1);
   ps.setBinaryStream(2,fis,(int)file.length());
   ps.execute();
   ps.close();
   fis.close();
The exception is thrown in this line:
 
ps.setBinaryStream(2,fis,(int)file.length());
Anybody know what is wrong?
 
TJM

pgsql-interfaces by date:

Previous
From: "Friedman, Eric"
Date:
Subject: RE: Newlines in String inserts with JDBC
Next
From: Jens Carlberg
Date:
Subject: Re: Newlines in String inserts with JDBC