SQLite Java:连接到加密的数据库

时间:2018-10-03 11:57:30

标签: java sqlite

假设我有一个名为mydb.db的数据库文件,并且该文件已加密。如何连接到Java并执行Java查询?

这就是我所做的

    try {
        // db parameters
        Class.forName("org.sqlite.JDBC");
        Properties props = new Properties();
        props.put("key", "XohImNooBHFR0OVvjcYpJ3NgPQ1qq73WKhHvch0VQtg=");

        String url = "jdbc:sqlite:" + DB_FILE;
        // create a connection to the database
        conn = DriverManager.getConnection(url, props);

        System.out.println("Connection to SQLite has been established.");

    } catch (SQLException e) {
        System.out.println(e.getMessage());
    }

.
.
.

PreparedStatement pstmt = conn.prepareStatement(sql);

但是我在尝试准备语句时遇到了这个错误

[SQLITE_NOTADB] File opened that is not a database file (file is encrypted or is not a database)

我正在使用sqlite-jdbc-3.7.15-M1.jar

0 个答案:

没有答案
相关问题