This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes JDBC and the fly likes Cannot connect to an Access 2007 Database (mdb) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Cannot connect to an Access 2007 Database (mdb)" Watch "Cannot connect to an Access 2007 Database (mdb)" New topic
Author

Cannot connect to an Access 2007 Database (mdb)

Jacky Luk
Ranch Hand

Joined: Aug 02, 2012
Posts: 590
I copy the code from the web that I want to connect to an Access 2007 database to Java
x86 office and x64 windows
the patient.mdb file is located in the same folder as the class files.

There are some messy codes in the stack trace.Here is where it happenedThanks.
Note that I've installed the AccessDatabaseEngine.exe file
I have created a DSN entry. Strange
Jack
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18541
    
    8

It looks like the Microsoft ODBC driver has sent you an error message in some language other than English. From your name I would guess it might be Chinese? At any rate something between the ODBC driver and wherever you displayed the stack trace has applied an incorrect charset encoding to the error message, rendering it unreadable.

Did you run the program at the command line, and then copied and pasted the stack trace from there? If so, you might get better results by running the program in an IDE like Netbeans or Eclipse -- but if you don't have one of them, installing one could be a lot of work. Alternatively you could try changing the code-page of the command line with the "chcp" command line. Although you'd have to look up a list of possible code-page values and see if there was one for your language.

Or alternatively you could modify your system so that English was its default language -- but this might be a radical step as well.
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18541
    
    8

Or if you want something simpler to try at first, try specifying the full path to the database file after "DBQ=" instead of relying on the database file being in your current working directory.
Jacky Luk
Ranch Hand

Joined: Aug 02, 2012
Posts: 590
Okay now, was using the wrong JDK x64
 
jQuery in Action, 2nd edition
 
subject: Cannot connect to an Access 2007 Database (mdb)
 
Similar Threads
Where is defination of inbuilt interfaces are written?
Connection to MySql Database
need help on dynamic loading of jdbc driver
"Unable to load JdbcOdbc library". Help please?!
Problem in connecting to DB2 using JDBC