Print Page | Close Window

Moving the DB out of the wwwroot dir

Printed From: Web Wiz Forums
Category: Web Wiz Web App Support Forums
Forum Name: Web Wiz Forums
Forum Description: Support forum for Web Wiz Forums application.
URL: https://forums.webwiz.net/forum_posts.asp?TID=9300
Printed Date: 07 April 2026 at 6:54pm
Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com


Topic: Moving the DB out of the wwwroot dir
Posted By: evening_grosbea
Subject: Moving the DB out of the wwwroot dir
Date Posted: 27 January 2004 at 9:43pm

How can I map the database to a dir outside of the wwwroot directory ?


 'Virtual path to database
 strDbPathAndName = Server.MapPath("?")

Thanks in advance




Replies:
Posted By: neotrix
Date Posted: 27 January 2004 at 9:51pm

instead of defining the vertual path, define the physical path, and u can host it anywhere. even out side the www rote directory



-------------
http://www.muhammadbinyusrat.com/blog/" rel="nofollow - Say to the believing men..


Posted By: dpyers
Date Posted: 28 January 2004 at 1:17am
The virtual path will look something like "C:\somedir\somedir\mydb.mdb"

-------------

Lead me not into temptation... I know the short cut, follow me.


Posted By: evening_grosbea
Date Posted: 28 January 2004 at 7:40am

DP - I assume you meant to type "physical path"?

Also - How can I find out what drive my site is on with my host.  Do I just contact them, or can this be accomplished using FTP or another method?

Thanks



Posted By: neotrix
Date Posted: 28 January 2004 at 8:45am

there are many ways to do it, there must be a file manager in ur CP, most of the file managers show you the physical path.. and there is mod as well



-------------
http://www.muhammadbinyusrat.com/blog/" rel="nofollow - Say to the believing men..


Posted By: Eftie
Date Posted: 28 January 2004 at 10:15am
And your provider has to allow physical path mapping and/or ../ in the servermappath function, otherwise youre stuck as well

-------------
Eftie


Posted By: snapey
Date Posted: 28 January 2004 at 5:49pm

To find your physical path, enter this in a page

   response.write(server.MapPath("/"))

This will show you the physical path to your root directory.

My hosting company has all web content in a folder called htdocs, and then parallel to this is a folder called private. So whenever I want to access a file in the private area I use something like:

strRootPath = Server.MapPath("/")
strDbPathAndName
=((Left(strRootPath,len(strRootPath)-6)) & "private/wwForum.mdb")

There should be 2 lines above, but the second has wrapped so be sure to enter it all on one line.
I'm no ASP expert, but what this does is a) get the physical path to the root of the web site. Then b) find the length of that path and remove 6 (the number of characters in htdocs) This gives me the physical path to the root of my hosted web space. I can then add on the folder and database name that I am interested in.

Why go to all this trouble? Because I can use the same code on any of my sites, and the physical path may change, but I can always find my databases no matter which site it is, or which folder the asp is running in.

 



Posted By: evening_grosbea
Date Posted: 28 January 2004 at 7:39pm
Awesome response Snapey - Thanks!


Posted By: dpyers
Date Posted: 28 January 2004 at 9:52pm

Originally posted by evening_grosbea evening_grosbea wrote:

DP - I assume you meant to type "physical path"?

<dopeslap action="uppercut" location="upside-head"> DOH !</dopeslap>



-------------

Lead me not into temptation... I know the short cut, follow me.



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.08 - https://www.webwizforums.com
Copyright ©2001-2026 Web Wiz Ltd. - https://www.webwiz.net