0

I'm getting an error while trying to make a JDBC connection to an Access 2007 database.

Environment details : Windows 7 64-bit, JRE 7 64-bit, Access 2007 32-bit:

driver = "sun.jdbc.odbc.JdbcOdbcDriver";
url = "jdbc:odbc:Driver={Microsoft Access Driver (*.mdb, *.accdb)};DBQ="+database+";";
DriverManager.getConnection(url, dbusername, dbpassword);

I'm getting the following exception

java.sql.SQLException: [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified
Gord Thompson
  • 116,920
  • 32
  • 215
  • 418
RaG
  • 317
  • 7
  • 19

2 Answers2

1

Installing the 32-bit version of Access only installs the 32-bit version of the Access Database Engine. The obvious fix would be to download and install the 64-bit version of the Access Database Engine from here, but the 64-bit installer will quit if it detects any 32-bit Office applications on the machine. So, your options are:

  • switch to a 32-bit Java environment, or

  • switch to a 64-bit version of Access.

Gord Thompson
  • 116,920
  • 32
  • 215
  • 418
1

The JdbcOdbcDriver is just a bridge for ODBC. You are using Access 32 bits so the ODBC for it is 32 bits. You won't be able to see it in the normal ODBC manager, and will have to use the C:\Windows\SysWOW64\odbcad32.exe to see it. For that reason Java 64 won't find it.

Basically, what you are trying to do is not possible. You should use Java 32 bits to make it run. I think there is no ODBC 64 bits for Access 2007, but you could try that route if it's paramount that you use Java 64. In any case the root of your problem is that in Window 64 you have 2 different DSN sets, one for 64-bits and one for 32-bits, that you can only see using C:\Windows\SysWOW64\odbcad32.exe

Julen
  • 55
  • 3