我正在使用SQLite,我无法将图像保存到数据库。 这是我的代码:无法将图像保存为blob到sqlite
File file = new File(url);
try {
fis = new FileInputStream(file);
} catch (FileNotFoundException e) {}
fileLenght = (int) file.length();
stat.executeUpdate("create table "+tableName+" (id int,name String ,image Blob, features String);");
prep = conn.prepareStatement("insert into "+tableName+" values (?, ?, ?, ?);");
prep.setBinaryStream(3, fis, fileLenght);
这是我收到的错误:
java.sql.SQLException: not implemented by SQLite JDBC driver
at org.sqlite.Unused.unused(Unused.java:29)
at org.sqlite.Unused.setBinaryStream(Unused.java:58)
我使用下面的jar:sqlitejdbc-v056.jar。
任何想法? 谢谢
我用setBytes替换setBinaryStream,它的工作....谢谢你:) – Mara 2011-05-22 20:40:46
金:完全没有想到,工作,但很高兴它做到了:-) – Femi 2011-05-22 20:58:34
惊讶有没有是比这个更新的/完整的JDBC驱动程序 – Femi 2011-05-22 20:58:59