简体   繁体   中英

Retrieving image from sqlite database java

Trying to retrieve stored images from sqlite database but don't seem to be having any luck. My code:

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();
}

The errors which i'm getting are:

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)

The SQLite JDBC implementation you're using doesn't implement getBinaryStream .

You'll need to use the getBytes method instead.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM