I have new problems. I would like to store the images in Oracle as
bfile. The table and directory are produced as:
stmt.execute("CREATE TABLE btable(bid int PRIMARY KEY not null, titel
varchar2(500), bild ORDSYS.ORDImage)");
stmt.execute("CREATE OR REPLACE DIRECTORY location AS '
C:\\Programme\\eclipse-SDK-2.1.1-win32\\eclipse\\workspace\\Datei_Sammlung\\Bild_ordner
'");
The grant distributed through:
stmt.execute("GRANT READ ON DIRECTORY location TO PUBLIC WITH GRANT
OPTION");
With the following java programm, i insert the date in the btable:
PreparedStatement pstmt = con.prepareStatement("INSERT INTO
bildtable_extern VALUES(?, ?, null)");
for (int ef=1; ef<=anzahl_summe; ef++){
pstmt.setInt(1, ef);
pstmt.setString(2, ftitel[ef]);
pstmt.execute();
stmt.executeUpdate("UPDATE btable SET bild =
ORDSYS.ORDImage.init('file', 'location', '" + f_name[ef] + "') where
bid = " + ef);
OracleResultSet rs_img = (OracleResultSet)stmt.executeQuery("SELECT *
FROM btable WHERE b_id = " + ef + " FOR UPDATE");
while (rs_img.next()){
OrdImage imgObj = (OrdImage)rs_img.getCustomDatum(3,
OrdImage.getFactory());
imgObj.setProperties(); //here is wrong
OraclePreparedStatement orpstmt =
(OraclePreparedStatement)con.prepareStatement("UPDATE btable SET bild
= ? WHERE bid =" + ef);
orpstmt.setCustomDatum(1,imgObj);
orpstmt.execute();
orpstmt.close();
}
}
But i get always the error message:
java.sql.SQLException: ORA-22285: non-existent directory or file for
FILEOPEN operation
ORA-06512: in "ORDSYS.ORDIMG_PKG", line 608
ORA-06512: in "ORDSYS.ORDIMAGE", line 65
ORA-06512: in line 2
What's the trouble with Oracle interMedia? I can not set the
properties for images. But I have already read the same example in
oracle interMedia java Classes User's Guide and Reference. Why do I
always get the errors? please help. (I use oracle 9i and windows
server 2003)
thank you very much and greeting from germany
rabbit