【发布时间】:2017-08-26 22:16:54
【问题描述】:
我的 Java 项目中的 SQLite 连接有问题。错误看起来像这样:
找不到适用于 JDBC:sqlite:main.db 的驱动程序
这是我的代码:
public static void main(String[] args) {
Connection c = null;
try {
// Class.forName("org.sqlite.JDBC");
String url = "JDBC:sqlite:main.db";
c = DriverManager.getConnection(url);
System.out.println("Connection to sql");
} catch ( SQLException e ) {
System.err.println( e.getMessage() );
} finally {
try{
if( c!= null ) {
c.close();
}
}catch( SQLException ex )
{
System.out.println(ex.getMessage());
}
}
}
你能帮帮我吗?
【问题讨论】: