问题描述
- sun.jdbc.odbc.JdbcOdbcDriver.connect
-
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); String url = "jdbc:odbc:driver={Microsoft Access Driver (*.mdb)};DBQ="+"D://Database2.mdb"; Connection con = DriverManager.getConnection(url); Statement st = con.createStatement(); 上面java代码 这行Connection con = DriverManager.getConnection(url);空指针
java.lang.NullPointerException
at sun.jdbc.odbc.JdbcOdbcDriver.initialize(JdbcOdbcDriver.java:453)
at sun.jdbc.odbc.JdbcOdbcDriver.connect(JdbcOdbcDriver.java:153)
at java.sql.DriverManager.getConnection(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at com.servlet.login.ShowServlet.doPost(ShowServlet.java:32)
at com.servlet.login.ShowServlet.doGet(ShowServlet.java:19)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:620)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
解决方案
D://Database2.mdb
->
D:\Database2.mdb
or
D:/Database2.mdb
时间: 2024-11-05 12:16:55