Connecting to an MS Access database using ASP or ColdFusion

If you are using ASP or ColdFusion to connect to your MS Access database, you can use a DSN connection (if you have requested a DSN) or  a DSNless connection.


To use a DSN, follow this format:

Set conn = Server.CreateObject("ADODB.Connection") "DSN= databasename_domain_com


To use a DSN-less connection, follow this format:

mdbfile = "/stuff/sample.mdb"

connstr = "Driver={Microsoft Access Driver (*.mdb)};DBQ=" & Server.MapPath( mdbfile ) & ";"


When troubleshooting a connection that does not work, make sure the driver string is included on one line without breaks.