Since Microsoft does not provide 64 bit drivers for Access; it becomes a nuisance to access MS Access under 64 bit platforms.
For a successfull connection to MS Access DB File (*.mdb) with JDBC under 64 bit platforms, follow following steps:
1- Make sure Access drivers are installed. If access is installed it is already there, else download from this link and install.
2- Configure Data Source Name using 32 bit ODBC Data Source Administrator. Use the executable at c:\windows\sysWOW64\odbcad32.exe.
3- System DSN->Add->Microsoft Access Driver (*.mdb)
- Specify a Data Source Name
- Specify a description
- Locate mdb file.
- Click OK.
Picture 1 DSN Setup for MS Access
Picture 2 New DSN
4- Use code fragment below to obtain connection.
private static Connection getConnection() throws SQLException, ClassNotFoundException {
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
return DriverManager.getConnection("jdbc:odbc:SGECA");
}
5- Launch Java application using 32 bit JVM which can be found under:
C:\Program Files (x86)\Java\jre7
Comments
Post a Comment