I'm trying to insert byte array into a blob column in sqlite database. I've tried with both setBinaryStream and setBytes, but I'm getting not implemented by SQLite JDBC driver exception. I'm using sqlite-jdbc-3.8.7.jar.What jar should I use to get this work? Thanks!
Here's my code:
public void addDriverData(String prenume,String nume,String telefon,String email,String permis,String parola,byte[] photo) throws SQLException
{ String sql = "INSERT INTO driver(first_name,last_name,phone,email,permit,password,photo)VALUES(?,?,?,?,?,?,?)";
PreparedStatement stm = c.prepareStatement(sql);
stm.setString(1,prenume);
stm.setString(2,nume);
stm.setString(3,telefon);
stm.setString(4,email);
stm.setString(5,permis);
stm.setString(6, parola);
//stm.setBinaryStream(7,new ByteArrayInputStream(photo),photo.length);
stm.setBytes(7, photo);
System.out.println(sql);
stm.executeUpdate(sql);
stm.close();
c.commit();
}
setBytes()is definitely supported in sqlite-jdbc-3.8.7.jar. Are you sure you're getting the "java.sql.SQLException: not implemented by SQLite JDBC driver" message when you try to usesetBytes()?stm.executeUpdate()instead ofstm.executeUpdate(sql). See if that works in conjunction withsetBytes()in the parameter list.