0

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,"","");
Kara
  • 5,650
  • 15
  • 48
  • 55
  • Try to use ucanaccess instead of odbc just follow this http://stackoverflow.com/questions/21955256/manipulating-an-access-database-from-java-without-odbc][1] – user3808015 Sep 11 '14 at 09:54

1 Answers1

1

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).

HansUp
  • 92,185
  • 11
  • 67
  • 122
  • I have changed the DRIVER piece of code matched with Microsoft Access accdb ODBC Driver example from ConnectionString.com. but it is'nt working.. Please tell where to change or select the ACE driver.... – Amitav Pajni May 01 '13 at 05:39
  • It is not included in Windows. You can download and install it separately: http://www.microsoft.com/en-us/download/details.aspx?id=13255 – HansUp May 01 '13 at 05:45
  • It is done....really thankful your support.... :) Can you please tell me what changes this ACE Driver do ? – Amitav Pajni May 01 '13 at 15:02
  • The ACE driver add support for the new ACCDB db format and is also backwards-compatible to support the older MDB format. The 64 bit ACE version can be used by 64 bit applications. The older Access driver was only available in 32 bit. – HansUp May 02 '13 at 18:38