Article

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

« Go Back

Information

 
Description

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.

• http://support.microsoft.com/default.aspx?scid=kb;EN-US;q209126
• http://support.microsoft.com/?kbid=286222

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"))
      dbconn.Open()
      sql="SELECT * FROM valid_entity"
      dbcomm=New OleDbCommand(sql,dbconn)
      dbread=dbcomm.ExecuteReader()
               :
               :
           bind data to web server controls
               :
               :
      dbread.Close()
      dbconn.Close()
   end sub
</script>

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
"verb="*"type="System.Web.HttpForbiddenHandler"preCondition="integratedMode"
/></handlers></system.webserver>

Attachment 
Attachment_2 
Attachment_3 
Attachment 4 
Feedback

Was this article helpful?

 
Feedback

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

Characters Remaining: 255