Insert an ImageTag(s): JDBC


File file = new File("myimage.gif");
FileInputStream fis = new FileInputStream(file);
PreparedStatement ps = 
   conn.prepareStatement("insert into images values (?,?)");
ps.setString(1,file.getName());
ps.setBinaryStream(2,fis,(int)file.length());
ps.executeUpdate();
ps.close();
fis.close();

blog comments powered by Disqus