Guest User

Untitled

a guest
Apr 24th, 2018
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.69 KB | None | 0 0
  1. try{
  2. Class.forName("oracle.jdbc.driver.OracleDriver");
  3. Connection con=DriverManager.getConnection(
  4. "jdbc:oracle:thin:@localhost:1521:xe","ZTRENDS","ZTRENDS");
  5.  
  6. PreparedStatement ps=con.prepareStatement("UPDATE ITEMSn" +
  7. "SET name = ?, photo= ?" +
  8. "WHERE item_ID = ?;");
  9. ps.setString(1,"sonoo");
  10.  
  11. FileInputStream fin=new FileInputStream("C:\picture000.jpg");
  12. ps.setBinaryStream(2,fin,fin.available());
  13. ps.setInt(3,1);
  14. int i=ps.executeUpdate();
  15. System.out.println(i+" records affected");
  16. System.out.println(ps);
  17. con.close();
  18. }catch (Exception e) {e.printStackTrace();}
Add Comment
Please, Sign In to add comment