Does anyone know how to access a Microsoft 2010 Access database from a Java program running on a Windows Vista OS? An open source, or at least free solution would be preferred, but I will consider a commercial product if necessary.
I have tried a number of ways that I turned up by searching the web (all based on ODBC->JDBC), but none of them seem to work.
Murdoch, thanks for your answer. My response was too big for a comment, so I'll add it here.
Unfortunately, I don't seem to be able to set up the ODBC bridge on Vista running Microsoft Access 2010. The "System DSN" tab of the ODBC Data Source Administrator only displays the SQL-Server driver when I click on the "Add..." button.
I'd like to set up a System DSN, but, if I have to, I might be able to do with a User DSN. When I open the "User DSN" tab I see "MS Access Database" listed, but if I select it and click the "Configure..." button a message box pops up telling me that "The setup routines for the Microsoft Access Driver (*.mdb, *.accdb) ODBC driver could not be found. Please reinstall the driv开发者_如何学编程er." I have tried a number of workarounds that I have found on the web, but none of them seem to work for me.
You need to use the JDBC ODBC Bridge driver, create an ODBC datasource and connect using JDBC something like this.
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection conn = DriverManager.getConnection("jdbc:odbc:<data-source-name>");
EDIT: I should have also added, you can set up the ODBC data source in the control panel, goto Control Panel > Administrative Tools > Data Sourced (ODBC)
I think I found the solution. If you are having a similar problem take a look at the following blog post on how to use ...
Microsoft Access ODBC drivers for Vista x64
Now that the JDBC-ODBC Bridge has been removed from Java 8 a better approach would be to use the UCanAccess JDBC driver. For more information see
Manipulating an Access database from Java without ODBC
精彩评论