Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Error while inserting image in database
- Exception in thread "main" java.lang.AbstractMethodError: oracle.jdbc.driver.OraclePreparedStatement.setBlob(ILjava/io/InputStream;)V
- at ImageStore.main(ImageStore.java:28)
- public class ImageStore {
- /**
- * @param args
- * @throws Exception
- */
- public static void main(String[] args) throws Exception {
- Class.forName("oracle.jdbc.driver.OracleDriver");
- Connection con = DriverManager
- .getConnection("jdbc:oracle:thin:@localhost:1521:orcl",
- "usrname", "password");
- String sql="update items set image=? where id=1";
- //String sql="select * from price";
- PreparedStatement ps=con.prepareStatement(sql);
- File f=new File("E:/Images/s.jpg");
- InputStream fos= new FileInputStream(f);
- ps.setBlob(1, fos);
- ps.execute();
- /*while(rs.next())
- System.out.println(rs.getInt(1));
- */
- ps.close();
- con.close();
- }
Add Comment
Please, Sign In to add comment