Skip to Main Content

Java Database Connectivity (JDBC)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Inserting values into blob and Clob fields

843854May 7 2003 — edited Aug 29 2003
I am trying to insert blob and clob fields into database in student table, i am using prepared statement , but it is not working, if any one knew how to insert please let me know.
thanks



Inserting a blob using prepared statemnet

FileInputStream fis=new FileInputStream(argv[5]);

String INSERT_QUERY = "Insert into Student(Photo) values(?)";
ps =con.prepareStatement(insert_picture);

//Using ps.setBinaryStream() instead of ps.setBytes to retrieve source for BLOB value to be inserted into the database

ps.setBinaryStream(1,fis,fis.available());

//Execute the prepared statement
ps.executeUpdate();
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Sep 26 2003
Added on May 7 2003
5 comments
271 views