Connecting Microsoft Access with Java

Contents

Introduction

To connect Java with Microsoft Access, you need a JDBC driver. Although Microsoft do not produce a JDBC driver for Microsoft Access, Easysoft provide two Microsoft Access JDBC drivers. Use these JDBC drivers to provide the connectivity layer between your Java code and Microsoft Access database.

Prerequisites

  • An installed and licensed Easysoft JDBC-ODBC Bridge server on a supported Windows platform that has Microsoft Office installed.

    If you have not yet installed the JDBC-ODBC Bridge or you're having problems with the installation, use our Getting Started Guide to help you through the installation.

  • An existing Access database file (.mdb) on the Windows machine.

Configuring the Microsoft Access ODBC data source

In the Windows ODBC Data Source Administrator, choose the System DSN tab, and then choose Add.

Give your data source a meaningful name and then choose Select. Browse to your .mdb file.

Once you've chosen the database, use the OK buttons to exit the dialog box. You've now created your data source.

You can now work with your Access data in applications such as:

Common problems

Why can't I connect to my Microsoft Access database using the Easysoft JDBC-ODBC Bridge?

The problem is likely to be that the Microsoft Access .mdb file is on a mapped network drive that can only be accessed by a named user.

There are three possible solutions:

  • Move the .mdb file to a drive that can be accessed by a service.
  • Run the JDBC-ODBC Bridge service as the user who has access to the drive or .mdb file.
  • Add the following attributes to the JDBC connection URL:
    logonuser=user name:logonpassword:password

Why do I get the error "Client denied access due to access control rule"?

The machine you're running the JDBC-ODBC Bridge JDBC client on has attempted to connect to the specified JDBC-ODBC Bridge server, but there is an access control rule on the server machine that denies your client access. You need to use the JDBC-ODBC Bridge web administration interface to examine the access control rules. Point a web browser at:

http://myserver:8031

Then choose Security. The access control rules are defined on this page.