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:
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.sun.jdbc.odbc.JdbcOdbcDriver
Drive Name:
MS Access via JDBC
Username, Password:
If the database requires any username, password, specify those.Submit and and that's it.


You could always do what the error msg says and "use the MS Access with Unicode driver instead" :)
Select it from the drop-down, and off you go.
March 7, 2007 1:21 AM
Is that driver built into cf?
And how is the performance? Can you tell any difference in using the jdbc vs. the jdbc/odbc bridge?
March 7, 2007 5:05 AM
Yes, check it out in the drop-down in the DSN page. We've shipped it since CF 6.1. It's the "Jadazoom" driver. Performance should be pretty good, actually, since it's also a Type-2 driver (calls the DLL's directly)
See here for more info...
http://livedocs.adobe.com/coldfusion/6.1/htmldocs/...
HTH
Damon
March 7, 2007 5:45 AM
Hm, didn't try the unicode one. And it does seem to work! Very good. Thanks.
March 7, 2007 6:43 AM
Cancel my earlier comment.
CF on Mac does not ship with sun.jdbc.odbc.JdbcOdbcDriver. So that won't work.
So now, on to figure out what will get a Microsoft Access DSN going on CF.
August 9, 2007 8:31 AM