假设我有一个名为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