我想将 Java 8 与 Access 连接,但出现以下错误,我不知道如何修复它。我总是收到这个错误:
java.sql.SQLException:没有找到适合 jdbc:ucanaccess://C:/Users/Ghazi/workspace/java w access/login.accdb 的驱动程序
我添加了 4 个库:
- hsqldb.jar
- jackcess-2.0.7.jar
- org.apache.commons.lang-2.6-source.jar
- org.apache.commons.loggin-1.1.1-source.jar
这是我的代码
import java.sql.*;
public class DbConnection {
Connection con;
Statement st;
DbConnection(){
dbconnect();
}
//-----------------------
public void dbconnect(){
try
{
Connection conn=DriverManager.getConnection("jdbc:ucanaccess://C:/Users/Ghazi/workspace/java w access/login.accdb");
Statement stment = conn.createStatement();
}
catch(Exception err)
{
System.out.println(err);
}
}
//--------------------------
public static void main(String[]args){
DbConnection ob=new DbConnection();
}//end main
}