File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JDBC and Relational Databases and the fly likes Win7 MSAccess Cannot get DB Connection Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "Win7 MSAccess Cannot get DB Connection" Watch "Win7 MSAccess Cannot get DB Connection" New topic

Win7 MSAccess Cannot get DB Connection

Will Barbee
Ranch Hand

Joined: Oct 01, 2008
Posts: 41
After correcting for the 32-bit/64-bit driver problem in Win7,
I entered the necessary (I thought) DSN's to get MSAccess
usage with a Java program.

I went under c:\windows\syswow64\ to find odbcad32 and ran it
to get the 32-bit drivers set up:

On the first display under the System DSN tab, I clicked "Add".
On the next window "Create New Data Source,
I clicked on Microsoft Access Driver (*.mdb) and clicked "Finish".
On the third window, I entered th MSAccess DB name in the Data
Source Name field "Atb_Basc".
I entered a description in the Description field.
Under Database, I clicked on "Select" then found the MSAccess
database, clicked on it to update it into the DSN.
At this point, the System DSN should have the Data Source Name
connected to the actual database.

I repeated the above for a User DSN just to be sure.

All appears to be correct but I get an error message during the
connection process. (Let me add that this code was working fine
when I was using WinXP.) The Java code snippets are:

And the full error message displayed is:
"Failed to get DB connection./java.sql.SQLException: [Microsoft][ODBC Driver Manager]
Data Source Name not found and no default driver specified."

But I used that Data Source Name in the Driver setup and I connected it to the DB.

Obviously I've missed or forgotten something since the last time I worked on this
set of programs.

Can someone please advise what I am missing?
Thank you
Will Barbee
Ranch Hand

Joined: Oct 01, 2008
Posts: 41
ARRRRRGGGHHHH! I mis-spelled the name.

Lessons Learned:
After all these years, spelling can be your biggest error producer.
Always re-check spelling (especially before posting on JavaRanch).
I agree. Here's the link:
subject: Win7 MSAccess Cannot get DB Connection
It's not a secret anymore!