Problem accessing database from within a folder...

S

supasnail

I have a happily working set of asp pages which read from the database
via include file "./_private/include/database.mdb".
However, when I try to gain access to this database on pages one
folder removed using "../_private/include/database.mdb", the pages
won't display. This whole system works fine on my home test server
(iis.5.0), but 'breaks' when uploaded to the public server. I know the
path to database is correct because the upper level pages are
displaying without problem. I am utterly perplexed and any suggestions
would be welcome. I'm using Acess database.

Thank you
 
E

Evertjan.

supasnail wrote on 02 nov 2006 in microsoft.public.inetserver.asp.general:
I have a happily working set of asp pages which read from the database
via include file "./_private/include/database.mdb".
However, when I try to gain access to this database on pages one
folder removed using "../_private/include/database.mdb", the pages
won't display. This whole system works fine on my home test server
(iis.5.0), but 'breaks' when uploaded to the public server. I know the
path to database is correct because the upper level pages are
displaying without problem. I am utterly perplexed and any suggestions
would be welcome. I'm using Acess database.

Use absolute references or server.mapPath() them.

Include files just drop their text content into the calling file,
so the current virtual directory is that of the same calling file.
 
M

Mike Brind

supasnail said:
I have a happily working set of asp pages which read from the database
via include file "./_private/include/database.mdb".
However, when I try to gain access to this database on pages one
folder removed using "../_private/include/database.mdb", the pages
won't display. This whole system works fine on my home test server
(iis.5.0), but 'breaks' when uploaded to the public server. I know the
path to database is correct because the upper level pages are
displaying without problem. I am utterly perplexed and any suggestions
would be welcome. I'm using Acess database.

Thank you

Parent paths (using ../../) are enabled by default on IIS5. The default for
IIS6 is that they are not enabled, so this may be the problem if your public
server is windows 2003. If it's your server, you can enable parent paths,
but this is not recommended. If it's not your server, you are unlikely to
persuade your host to enable parent paths. Consequently, you will need to
use a full path in your connection string.

This can be obtained by creating a file called mappath.asp with this
content:

<%Response.Write Server.Mappath("mappath.asp")%>

and placing it in the include folder. Then browse to it.
(www.mydomain/root/_private/include/mappath.asp). It will display the full
path.
 
S

supasnail

I'm not quite sure what you're saying, If I use absolute references on
each page for the database then I would have to change over 30 files
when I upload to the public server after testing, similarly if I use an
absolute path to the include file. Also I am having trouble
understanding why this entire web site functions correctly on my test
server and not on the public server. It only breaks when i attempt to
call the database from pages one directory removed. Have I
misunderstood the advice?
 
E

Evertjan.

supasnail wrote on 02 nov 2006 in
microsoft.public.inetserver.asp.general:

[Please do not toppost on usenet]
I'm not quite sure what you're saying, If I use absolute references on
each page for the database then I would have to change over 30 files
when I upload to the public server after testing, similarly if I use
an absolute path to the include file.

No, not "off" the include file, but address of the database as staed in
the include file cannot be relative to that file, when you plan to call
that file as an include from files in different virtual directories.

So you only change the include file.

[I do not understand what is wrong in correcting 30 files, if you would
have made a mistake in those 30. If you are lazy: editors like Editpadpro
will do that in one move.]
Also I am having trouble
understanding why this entire web site functions correctly on my test
server and not on the public server. It only breaks when i attempt to
call the database from pages one directory removed. Have I
misunderstood the advice?

The whole point of setting up a working site [with serverside code] is
thorough testing and debugging. Perhaps your virtual root directory
[using server.mappath()] is different or whatever. Point is to get it
working.
 
S

supasnail

I must apologise, I made an error in my forst question, perhaps because
my head is spinning from confusion lol. Where I wrote,
"./_private/include/database.mdb", it should have read
"./_private/include/path.asp" the contents of which is and has always
been the absolute path to the database.

I hope now my previous response makes a little more sense and I
apologise again for creating that confusion.

I have been going round in circles trying to understand this problem,
the site works perfectly on my test server.

S



Evertjan. said:
supasnail wrote on 02 nov 2006 in
microsoft.public.inetserver.asp.general:

[Please do not toppost on usenet]
I'm not quite sure what you're saying, If I use absolute references on
each page for the database then I would have to change over 30 files
when I upload to the public server after testing, similarly if I use
an absolute path to the include file.

No, not "off" the include file, but address of the database as staed in
the include file cannot be relative to that file, when you plan to call
that file as an include from files in different virtual directories.

So you only change the include file.

[I do not understand what is wrong in correcting 30 files, if you would
have made a mistake in those 30. If you are lazy: editors like Editpadpro
will do that in one move.]
Also I am having trouble
understanding why this entire web site functions correctly on my test
server and not on the public server. It only breaks when i attempt to
call the database from pages one directory removed. Have I
misunderstood the advice?

The whole point of setting up a working site [with serverside code] is
thorough testing and debugging. Perhaps your virtual root directory
[using server.mappath()] is different or whatever. Point is to get it
working.
 
S

supasnail

OK, I have found a solution - I am now using 'include virtual' rather
than 'include file' so i dont have to use ../../ for gaining access to
higher directories.



I must apologise, I made an error in my forst question, perhaps because
my head is spinning from confusion lol. Where I wrote,
"./_private/include/database.mdb", it should have read
"./_private/include/path.asp" the contents of which is and has always
been the absolute path to the database.

I hope now my previous response makes a little more sense and I
apologise again for creating that confusion.

I have been going round in circles trying to understand this problem,
the site works perfectly on my test server.

S

Evertjan. said:
supasnail wrote on 02 nov 2006 in
microsoft.public.inetserver.asp.general:
[Please do not toppost on usenet]
I'm not quite sure what you're saying, If I use absolute references on
each page for the database then I would have to change over 30 files
when I upload to the public server after testing, similarly if I use
an absolute path to the include file.
No, not "off" the include file, but address of the database as staed in
the include file cannot be relative to that file, when you plan to call
that file as an include from files in different virtual directories.
So you only change the include file.
[I do not understand what is wrong in correcting 30 files, if you would
have made a mistake in those 30. If you are lazy: editors like Editpadpro
will do that in one move.]
Also I am having trouble
understanding why this entire web site functions correctly on my test
server and not on the public server. It only breaks when i attempt to
call the database from pages one directory removed. Have I
misunderstood the advice?
The whole point of setting up a working site [with serverside code] is
thorough testing and debugging. Perhaps your virtual root directory
[using server.mappath()] is different or whatever. Point is to get it
working.
 
E

Evertjan.

supasnail wrote on 02 nov 2006 in microsoft.public.inetserver.asp.general:
OK, I have found a solution - I am now using 'include virtual' rather
than 'include file' so i dont have to use ../../ for gaining access to
higher directories.

Congtrats, but:

[Please do not toppost on usenet]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,070
Latest member
BiogenixGummies

Latest Threads

Top