How to Connect to MS Access Database from ASP

This is only brief tutorial about how to connect MS Access database from Classic ASP. You can connect using OLEDB DSN-less connection, you can connect using ODBC connection or you can use DSN.

1. Connect to a Microsoft Access Database from ASP using a DSN

Set oConnection = Server.CreateObject("ADODB.Connection")
oConnection.Open "DSN=;UID=;PWD="
oConnection.Close

The ASP connection example above is very simple and all you need to do is to create a DSN for your MS Access database.

2. Connect to a Microsoft Access Database from ASP using DSN-less ODBC connection

Set oConnection = Server.CreateObject("ADODB.Connection")
oConnection.Open "DRIVER={Microsoft Access Driver (*.mdb)};DBQ=" &
Server.MapPath("") & ";UID=;PWD="
oConnection.Close
Set oConnection = Nothing

This ASP MS Access connection example doesn’t require DSN, but requires that you have Microsoft Access Driver installed on your computer/server.

3. Connect to a Microsoft Access Database from ASP using DSN-less OLEDB connection

Set oConnection = Server.CreateObject("ADODB.Connection")
oConnection.Open "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" &
Server.MapPath("") & ";"
oConnection.Close
Set oConnection = Nothing

This MS Access ASP connection example requires only the OLEDB provider to work.

Related Posts

Leave a Reply

Your email address will not be published. Required fields are marked *