SQLITE错误或缺少数据库(没有这样的表:路径)

问题描述 投票:0回答:1
 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());

        }
sql sqlite sqlconnection
1个回答
0
投票

您的连接无权访问现有的数据库文件。因此,它将创建一个新的(不同的)文件

© www.soinside.com 2019 - 2024. All rights reserved.