
import java.sql.*; import java.io.*; class Oracle2 { public static void main(String args[])throws Exception { DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver()); Connection con=DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:orcl","scott","tiger"); PreparedStatement stmt=con.prepareStatement("update image1 set photo=? where no=1"); File f=new File("Jellyfish.jpg"); FileInputStream fis=new FileInputStream(f); stmt.setBinaryStream(3,fis,(int)f.length()); System.out.println("Image length: "+f.length()); System.out.println("No.of rows affected: "+stmt.executeUpdate()); } }
My Oracle table description is: create table image1(no int, name varchar2(20), photo blob);
Please answer soooooooon....
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.
