How to connect java to Ms Access 2010?

后端 未结 6 1979
醉酒成梦
醉酒成梦 2020-12-05 09:05

Does anyone have any ideas of how to connect Access 2010 to java jdbc. I use this method, but when I call it, it doesn\'t work:

public void loadDb(){
   try{         


        
6条回答
  •  借酒劲吻你
    2020-12-05 09:12

    Spelling error? Perhaps this line:

    con = DriverManager.getConnection("jdbc:odbc:Driver={Microsoft Acess Driver (*.mdb, *.accdb)}; DBQ="+ f.getPath() + "//db//JavaAccess.accd","","");
    

    should be

    con = DriverManager.getConnection("jdbc:odbc:Driver={Microsoft Access Driver (*.mdb, *.accdb)}; DBQ="+ f.getPath() + "//db//JavaAccess.accd","","");
    

    Access has 2 C's

提交回复
热议问题