try {
// db parameters
String url = "jdbc:sqlite: db_path.db";
// create a connection to the database
conn = DriverManager.getConnection(url);
System.out.println("Connection to SQLite has been established.");
} catch (SQLException e) {
System.out.println(e.getMessage());
}
连接数据库后,将在项目文件夹中创建一个具有相同名称和大小0Kb的重复文件
String qurey = "INSERT INTO Path VALUES (?)";
try {
PreparedStatement state = DB_Path.conn.prepareStatement(qurey);
state.setString(1,path);
} catch (SQLException e) {
System.out.println(e.getMessage());
}
您的连接无权访问现有的数据库文件。因此,它将创建一个新的(不同的)文件