From: tjm2@mail.ikasths.dk
To: pgsql-interfaces@postgresql.org
Subject: JDBC Interface Using Large Objects
Date: Thu, 28 Sep 2000 09:54:21 +0200
Message-ID: <002901c02921$500af990$97bfedd4@pc4151> (raw)
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-interfaces@postgresql.org
Cc: tjm2@mail.ikasths.dk
Subject: Re: JDBC Interface Using Large Objects
In-Reply-To: <002901c02921$500af990$97bfedd4@pc4151>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox