• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JDBC + MS Access without ODBC data source

 
Scott Selikoff
author
Saloon Keeper
Posts: 4028
18
Eclipse IDE Flex Google Web Toolkit
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is there a standard method of connecting a Java application to an MS Access database that does not involve creating an ODBC data source? Basically, a driver that allows you specify the file path as the connection string and run queries against it directly.
 
Paul Clapham
Sheriff
Posts: 21416
33
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You'd use the ordinary JDBC-ODBC bridge driver. And your google keywords are "java dsn-less connection".
 
Scott Selikoff
author
Saloon Keeper
Posts: 4028
18
Eclipse IDE Flex Google Web Toolkit
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks, I was under the mistaken impression that the JDBC-ODBC bridge driver only worked via DSN. I did try some DSN-less samples but I'm getting the message:

"[Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified"
 
Paul Clapham
Sheriff
Posts: 21416
33
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
All I can say is, it worked when I tried it 10 years ago. Since then I have been lucky enough to not have to use Access with Java.
 
Scott Selikoff
author
Saloon Keeper
Posts: 4028
18
Eclipse IDE Flex Google Web Toolkit
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
After a lot of searching, I discovered a solution to this issue. Namely, I need to run with a 32bit JVM, as it does not appear to work in 64bit Java.
 
Scott Selikoff
author
Saloon Keeper
Posts: 4028
18
Eclipse IDE Flex Google Web Toolkit
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There is a solution for 64-bit Java although it requires some work:

1) Download Microsoft Access Database Engine 2010 Redistributable, AccessDatabaseEngine_x64.exe, and install it

2) If you are running a 32-bit version of Office, you will likely get the following error when you try to install it: "You cannot install the 64-bit version of Office 2010 because you have 32-bit Office products installed.". At this point, you must decide whether or not to uninstall the Office. Newer versions of Office, such as 2010, contain both both 32-bit and 64-bit versions on the DVD. In this case, you would first uninstall the 32-bit version of Office. Restart. Then ignore the auto-run on the DVD, and open the setup executable in the x64 directory. If you do not have access to a 64-bit version of Office, then you will unable to run the 32-bit version alongside the 64-bit Engine.

3) The connection string must be updated as follows:

 
Paul Clapham
Sheriff
Posts: 21416
33
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
64-bit processors... an issue I didn't have to deal with back in the Dark Ages. Thanks for posting the info, Scott!
 
Ulf Dittmer
Rancher
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That calls for adding to http://www.coderanch.com/how-to/java/OdbcJdbcQuestions :-)
 
Scott Selikoff
author
Saloon Keeper
Posts: 4028
18
Eclipse IDE Flex Google Web Toolkit
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm writing up a blog article about it now actually: Connecting to MS Access File via JDBC in 64-bit Java
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic