On Nov 16, 9:52 am, xeden <[email protected]> wrote:
> i want to insert an image in the database which is used in a game and
> connected via JDBC
>
> i tried it through procedure (which i searched on internet)
> http://www.club-oracle.com/forums/insert-images-into-oracle-database-...
>
> , but it didnt worked
>
> if somebody can help , pls reply
>>VIA JDBC<< - then it is a Java program ?
Procedure in the URL you have provided is able to read a file from the
Oracle directory.
DBMS_LOB.loadfromfile can read a file only from a folder existing on
the Oracle server.
In your case, you have a Java program.
You need to read a file on your java server and then stream it into
Oracle database.
Example:
PreparedStatement oStmt = null;
java.io.InputStream oImage = null;
oStmt = oConn.prepareStatement("INSERT INTO MYTABLE (id,fileitem)
values ( ?, ? )");
oStmt.setInt(1,<myID>);
oStmt.setBinaryStream(2,oImage, <length of oImage>);
oStmt.executeUpdate();
-- where fileitem is a BLOB column.
HTH
Thomas
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Oracle PL/SQL" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/Oracle-PLSQL?hl=en
-~----------~----~----~----~------~----~------~--~---