Search

I'll be at


My Twitter

    Subscribe

    Recent entries

    Archives by subject

    Archives by date

    Sun Mon Tue Wed Thu Fri Sat
            1 2 3
    4 5 6 7 8 9 10
    11 12 13 14 15 16 17
    18 19 20 21 22 23 24
    25 26 27 28 29 30 31
    6
    Mar

    Using JDBC to connect to Microsoft Access database

    I'm doing a training tomorrow for which I needed to use a demo Microsoft Access database.

    However, my laptop does not have ColdFusionMX 7 ODBC Server and ODBC Agent installed as Windows services. So, each time I try to setup a Microsoft Access datasource, I get a message:

    The ColdFusion MX 7 ODBC Server service is not running or has not been installed. You may also use the "MS Access with Unicode" driver to connect to MS Access datasources.

    As I didn't feel like manually installing the ODBC agent and server, I wondered if there was a way to simply use JDBC to connect directly to the Access database.

    And there is.

    In ColdFusion Administrator, create a datasource of the type "other". And use the following settings subsequently:

    JDBC URL:

    jdbc:odbc:Driver={Microsoft Access Driver (*.mdb)};DBQ=[Full path to your database file];DriverID22;

    Driver Class:

    sun.jdbc.odbc.JdbcOdbcDriver
    I prefer to always specify the Driver Name. It helps later to identify the database type from the datasource listing page. You can skip this if you don't give a toss.

    Drive Name:

    MS Access via JDBC

    Username, Password:

    If the database requires any username, password, specify those.

    Submit and and that's it.

    Comments