How to connect java to Ms Access 2010?

后端 未结 6 1992
醉酒成梦
醉酒成梦 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:21

    Rishab's reply helped me to connect to my access database.

    I did following correction in the code:

    Instead of

    String url = "jdbc:odbc:anime"; //anime is the database
    

    I did

    String url = "jdbc:odbc:Driver={Microsoft Access Driver (*.mdb, *.accdb)}; DBQ=" + "d://institute//institutedata.accdb";
    

    I explicitly defined driver and full database name with path and extension.

提交回复
热议问题