JDBC Interface Using Large Objects

Поиск
Список
Период
Сортировка
От tjm2@mail.ikasths.dk (Troels Jegbjaerg Moerch)
Тема JDBC Interface Using Large Objects
Дата
Msg-id 002901c02921$500af990$97bfedd4@pc4151
обсуждение исходный текст
Список 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 по дате отправления:

Предыдущее
От: "Friedman, Eric"
Дата:
Сообщение: RE: Newlines in String inserts with JDBC
Следующее
От: Jens Carlberg
Дата:
Сообщение: Re: Newlines in String inserts with JDBC