Our hosting platform supports connections to MS Access databases using DSN-less connection strings. We do not use System DSNs (Data Source Names) because DSN-less connections are faster, more reliable, and avoid naming conflicts on shared servers.
The most common cause of connection errors is an incorrect file path. Because your website runs on a shared server structure, you cannot use a hardcoded physical path (e.g., C:\Websites\MySite\db.mdb). Instead, you must use Server.MapPath to resolve the location dynamically relative to your website root.
Assuming your database is named TestDB.mdb and is located in a subfolder named Database, use the following code in your ASP pages:
<%
Dim DbConnection, ConnectionString, DbPath
' 1. Resolve the physical path
DbPath = Server.MapPath("Database\TestDB.mdb")
' 2. Define the connection string (DSN-less)
ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & DbPath
' 3. Open the connection
Set DbConnection = Server.CreateObject("ADODB.Connection")
DbConnection.Open ConnectionString
%>
Microsoft.Jet.OLEDB.4.0 provider is a 32-bit component. If your Application Pool is running in 64-bit mode, this connection will fail.
.accdb), use the Microsoft.ACE.OLEDB.12.0 provider.