我正在尝试学习如何使用本教程制作SQLite数据库http://www.sqlitetutorial.net/sqlite-java/create-table/ 但是我被卡住了。
我使用NetBeans编写了他们所说的代码(仅更改类的名称和查找文件的路径)。
package createnewtable;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.sql.Statement;
public class CreateNewTable {
public static void createNewTable(){
//SQLite connection string
String url = "jdbc:sqlite:/Volumes/..../Esercizi/test.db";
//SQL statement for creating a new table
String sql = "CREATE A TABLE IF NOT EXISTS warehouses ("
+ "id integer PRIMARY KEY,"
+ "name text NOT NULL,"
+ "capacity real)";
try (Connection conn = DriverManager.getConnection(url);
Statement stmt = conn.createStatement()){
//Create a new Table
stmt.execute(sql);
} catch(SQLException e){
System.out.println(e.getMessage());
}
}
public static void main(String[] args) {
createNewTable();
}
}
但是当我运行代码时,输出如下:
你能帮帮我吗?我的错误在哪里?找不到合适的jdbc驱动程序:sqlite:/ Volumes /.../ Esercizi / test.db"
提前致谢