Received: from mail.ikasths.dk (mail.ikasths.dk [212.237.188.3]) by hub.org (8.10.1/8.10.1) with ESMTP id e8S7rD719072 for ; Thu, 28 Sep 2000 03:53:14 -0400 (EDT) Received: from pc4151 ([212.237.191.151]) by mail.ikasths.dk (Post.Office MTA v3.5.2 release 221 ID# 0-62113U3000L300S0V35) with SMTP id dk for ; Thu, 28 Sep 2000 09:53:19 +0200 Message-ID: <002901c02921$500af990$97bfedd4@pc4151> From: tjm2@mail.ikasths.dk (Troels Jegbjaerg Moerch) To: Subject: JDBC Interface Using Large Objects Date: Thu, 28 Sep 2000 09:54:21 +0200 MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_0026_01C02932.134EF860" X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 5.50.4133.2400 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400 X-Archive-Number: 200009/107 This is a multi-part message in MIME format. ------=_NextPart_000_0026_01C02932.134EF860 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable 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 =3D new File(theFile); FileInputStream fis =3D new FileInputStream(file); PreparedStatement ps =3D 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 ------=_NextPart_000_0026_01C02932.134EF860 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
Hi
 
I am using the JDBC 7.0-1.2 driver, Postgr= eSQL 7.02=20 Database and JDK 1.3 on Linux Red Hat 7.0. Almost everything works great. B= ut=20 when I am trying to insert a file into my postg= resql=20 database I get this error:
 
SQLException: InputStream as parameter not= =20 supported
Here is my code:
 
   File file =3D new=20 File(theFile);
   FileInputStream fis =3D new=20 FileInputStream(file);

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