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 Access DB Connect Issues Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Make it so: Java DB Connections & Transactions this week in the JDBC forum!
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "Access DB Connect Issues" Watch "Access DB Connect Issues" New topic

Access DB Connect Issues

Bill Warner

Joined: Aug 30, 2006
Posts: 3
The following code:

public Connection getConnection(){
try {
String filename = "c:/IssuanceTracker/IssuanceTracker.mdb";
String database = "jdbcdbcriver={Microsoft Access Driver (*.mdb)};DBQ=";database+= filename.trim();
Connection con = DriverManager.getConnection( database ,"","");
return con;
catch (Exception e) {
System.out.println("Error: " + e);
return null;

Yields the following error:

at sun.jdbc.odbc.JdbcOdbcDriver.initialize(Unknown Source)
at sun.jdbc.odbc.JdbcOdbcDriver.connect(Unknown Source)
at java.sql.DriverManager.getConnection(
at java.sql.DriverManager.getConnection(
at issuancetracker.DataAccess.getConnection(
at issuancetracker.testmain.main(

I've included the rt.jar file in my project. I'm using WSAD 5.1.2. Can anyone please help. Thanks, Bill
Muhammad Saifuddin
Ranch Hand

Joined: Dec 06, 2005
Posts: 1321


String database = "jdbcdbcriver={Microsoft Access Driver (*.mdb)};DBQ=";database+= filename.trim();

try this

String url ="jdbcdbcRIVER={Microsoft Access Driver
(*.mdb)};DBQ= c:\\IssuanceTracker\\IssuanceTracker.mdb";

[ August 31, 2006: Message edited by: Saif Uddin ]

[Blog][Linkedin] How To Ask Questions On JavaRanch My OpenSource
Bill Warner

Joined: Aug 30, 2006
Posts: 3
Thanks for the replies! I get the same errors with the suggested changes.

I could really use some help. I'm new to Java and this problem doesn't seem to make sense. Co-workers can execute the same code successfully w/o error. Any help would be appreciated.
Ulf Dittmer

Joined: Mar 22, 2005
Posts: 42959
Instead of accessing the MDB file directly, have you tried setting up an ODBC data source? Some info about that can be found here.
I agree. Here's the link:
subject: Access DB Connect Issues
It's not a secret anymore!