Help storing jpeg files

Поиск
Список
Период
Сортировка
Искать

Help storing jpeg files

От:
Srikanth Rao <srirao_us@yahoo.com>
Дата:
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.(Compiled Code)
        at java.lang.Exception.(Compiled Code)
        at
java.sql.SQLException.(SQLException.java:98)
        at
org.postgresql.util.PSQLException.(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/
FAQ