java - 从sqlite数据库java中检索图像

标签 java database image sqlite

尝试从 sqlite 数据库检索存储的图像,但似乎没有任何运气。我的代码:

int i = 0;
while (resultSet.next()) {
    InputStream in = resultSet.getBinaryStream(1);
    OutputStream f = new FileOutputStream(new File("PeoplesInfo"+i+".jpg"));
    i++;
    int c = 0;
    while ((c = in.read()) > -1) {
        f.write(c);
    }
    f.close();
    in.close();
}

我遇到的错误是:

java.sql.SQLException: not implemented by SQLite JDBC driver
at org.sqlite.Unused.unused(Unused.java:29)
at org.sqlite.Unused.getBinaryStream(Unused.java:92)
at Database.main(Database.java:50)

最佳答案

您使用的 SQLite JDBC 实现未实现 getBinaryStream

您需要改用 getBytes 方法。

关于java - 从sqlite数据库java中检索图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24806919/

相关文章:

java - 如何告诉 Xalan 转义 HTML 属性中的字符

mysql - 如何检查 MYSQL_HISTIGNORE 中的当前字符串?

java - 保存整数的共享首选项

android - 在 Android 上设计图形

java - 如何在FileInputStream中加载外部图像

java - IntelliJ IDEA 14 : How to skip tests while deploying project into Tomcat

java - 字符串到本地日期错误

java - 了解 Camel 的输入/输出交换模式行为

android - 单击 listView 从数据库访问数据

部分显示的Android WebView图像