How do I use an MS Access Database with my website?

« Go Back



MS Access is not designed to be a high volume database engine. We don't recommend the use of MS Access databases for heavy traffic sites or sites where the database is providing dynamic content to the site via SQL queries, as it can dramatically slow your site down. The following links may assist with optimisation of your MS access database, but we recommend that you migrate your database to MSSQL or MySQL.


To add an MS Access database to your website, upload the database onto your hosting account via FTP and then connect your website to the database. You can add more than one MS Access database to your site if required, but it is not recommended that you have more than 4 separate databases.

Example connection string:

Below is an example of a DSN connection string. You can use this example when modifying your code to connect to your MS Access database:
<%@ Import Namespace="System.Data.OleDb" %>
<script runat="server">
   sub Page_Load
      dim dbconn,sql,dbcomm,dbread
      dbconn=New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;data source="& server.mappath("databasename.mdb"))
      sql="SELECT * FROM valid_entity"
      dbcomm=New OleDbCommand(sql,dbconn)
           bind data to web server controls
   end sub

MS Access database security:

To prevent the database from being downloaded directly via an HTTP connection, you will need to specify
the code below in your Web.config file:

<system.webServer><handlers><add name="MyForbiddenExtensionHandler"path="*.mdb

Attachment 4 

Was this article helpful?


Please tell us how we can make this article more useful.

Characters Remaining: 255