简体   繁体   中英

java connectivity with MS Access

I am writing this code but at runtime an excpetion is caught and says

[Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified

What is the problem?

String database="jdbc:odbc:Driver={Microsoft Access Driver(*.accdb)};DBQ=C:/Users/Amitav/Desktop/Database1.accdb;";

Connection con=DriverManager.getConnection(database,"","");

First change the Driver={...} piece to match the Microsoft Access accdb ODBC Driver example from ConnectionString.com .

Driver={Microsoft Access Driver (*.mdb, *.accdb)};

If that change isn't enough to fix the problem, you may have a mismatch between the ACE driver and Java. The ACE driver is available in separate 32 and 64 bit versions. You need to match the ACE version with your Java (32 or 64 bit).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM