This topic is locked

Multiple sites connecting to the same database

2/23/2005 11:26:38 PM
ASPRunnerPro General questions
author

I'm trying to make sites that connect with the same database. Both will talk with the same table - one requiring a login for entry to see / manipulate data and the other one allowing free entry to the table.
I can make the different sites, but the database (access) by default is contained within each one of them. I've tried to alter the default page with a ../ in front of it, which does cause the build to create the db folder outside the site. It also puts the ../ in the mappath statement in the db connection file. However, it doesn't work when published.
Maybe I'm just going about it the wrong way. In the end, there's no way to make one site that has all of the settings I need. I need to be able to create multiple builds that share the same database file.
Thank you,
Dan Royce

Sergey Kornilov admin 2/24/2005

Dan,
you have two choices here:

  1. If your web hosting provider allows creating ODBC DSN you can create one that points to your database and use this DSN while building ASP pages with ASPRunner.
  2. You can put your database file to the separate folder and adjust connection strings for both sites to point to the same database. Lets say you have the following folder structure:
    database

    site1

    site2


Here is the sample connection string that you can use:

"Provider=MSDataShape;DBQ=" & server.mappath("..\database\yourdatabasefilename.mdb") & ";Driver={Microsoft Access Driver (*.mdb)};DriverId=25;FIL=MS Access;MaxBufferSize=2048;PageTimeout=5;UID=admin;"


I hope this helps.