Help storing jpeg files

From: Srikanth Rao <srirao_us(at)yahoo(dot)com>
To: pgsql-jdbc(at)postgresql(dot)org
Subject: Help storing jpeg files
Date: 2001-02-02 16:41:19
Message-ID: 20010202164119.7205.qmail@web6302.mail.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

My table looks like this:
Table "office"
Attribute | Type | Modifier
--------------+--------+----------
officeid | bigint | not null
fees | oid |
map | oid |
Index: office_key

My code looks like this:

if (map != null && fees != null) {

File mapFile = new File("../webapps/cca/"+map);
FileInputStream mapFis = new
FileInputStream(mapFile);
File feesFile = new File("../webapps/cca/"+fees);
FileInputStream feesFis = new
FileInputStream(feesFile);

update_sql = "UPDATE Office SET \n " +
"map = ? , \n" +
"fees = ? \n" +
"WHERE officeId = " + officeId + "\n";
System.out.println(update_sql);

PreparedStatement ps =
theConnection_.prepareStatement(update_sql);

ps.setBinaryStream(1,mapFis,(int)mapFile.length());

ps.setBinaryStream(2,feesFis,(int)feesFile.length());
ps.executeUpdate();
ps.close();
feesFis.close();
mapFis.close();
}

My Exception that I get looks like this:

InputStream as parameter not supported
at java.lang.Throwable.fillInStackTrace(Native
Method)
at
java.lang.Throwable.fillInStackTrace(Compiled Code)
at java.lang.Throwable.<init>(Compiled Code)
at java.lang.Exception.<init>(Compiled Code)
at
java.sql.SQLException.<init>(SQLException.java:98)
at
org.postgresql.util.PSQLException.<init>(PSQLException.java:22)
at
org.postgresql.jdbc2.PreparedStatement.setBinaryStream(PreparedStatement.java:417)
at CCA_Model.Office.commit(Office.java:571)
....
....

I followed what was given in the PG-SQL docs.

TIA
Sri

__________________________________________________
Get personalized email addresses from Yahoo! Mail - only $35
a year! http://personal.mail.yahoo.com/

Browse pgsql-jdbc by date

  From Date Subject
Next Message Bruce Momjian 2001-02-02 17:55:14 Re: Re: [INTERFACES] Re: [PATCHES] Re: Fixes and enhancements to JDBC driver(take 2)
Previous Message Richard Bullington-McGuire 2001-02-02 14:30:08 Re: [INTERFACES] Re: [PATCHES] Re: Fixes and enhancements to JDBC driver(take 2)