2 csdnzlw csdnzlw 于 2016.02.23 20:50 提问

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)

1个回答

caozhy
caozhy   Ds   Rxr 2016.02.23 23:16
 D://Database2.mdb
->
D:\\Database2.mdb
or
D:/Database2.mdb
csdnzlw
csdnzlw java.io.IOException: Cannot run program "jad" (in directory "C:\Users\Administrator\.net.sf.jadclipse\1456277127516"): CreateProcess error=2, 系统找不到指定的文件。
接近 2 年之前 回复
Csdn user default icon
上传中...
上传图片
插入图片
准确详细的回答,更有利于被提问者采纳,从而获得C币。复制、灌水、广告等回答会被删除,是时候展现真正的技术了!