Link to home
Start Free TrialLog in
Avatar of Bruce Gust
Bruce GustFlag for United States of America

asked on

Relative path to my database on ipower...

I have no idea if being on an ipower server makes any difference. It seems that I've encountered different protocals depending on the ISP. In any case, I hoping there are some common denominators that apply so here's what I've got...

I'm using a Global.asa doc.

Where does it go? Does it go in the wwwroot directory or is it positioned outside that directory? Then, what should the script look like? Here's the way I have it on my C drive...

<SCRIPT LANGUAGE=VBScript RUNAT=Server>
Sub Session_OnStart
Session("dbConn_ConnectionString") ="Provider=Microsoft.Jet.OLEDB.4.0; Data Source=C:\Inetpub\wwwroot\BSP\Data\Shiny.mdb"
End Sub
</SCRIPT>

How will it look on an ipower?

I appreciate the help...
Avatar of DireOrbAnt
DireOrbAnt

Put your global.asap in your wwwroot directory or any virtual directory you create. Each virtual directory starts it's own ASP space, so you can use a different global.asa per virtual directory. For you, it looks like you need it in your root.
Avatar of Bruce Gust

ASKER

Does my path need to be anything more than Data/Shiny.mdb provided it's in the root directory?
you could just put your connection string in a file and include that file on all the pages instead of using the session object.


db.asp______
<%
Dim connstring
connstring = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=C:\Inetpub\wwwroot\BSP\Data\Shiny.mdb;"
%>
___________


anypage.asp____
...
<!--#include file="../Connections/db.asp"-->
<%
dim conn
set conn = server.CreateObject("ADODB.connection")
conn.open connstring
...
______________
ASKER CERTIFIED SOLUTION
Avatar of DireOrbAnt
DireOrbAnt

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
So the code would look like:

<SCRIPT LANGUAGE=VBScript RUNAT=Server>
Sub Session_OnStart
Session("dbConn_ConnectionString") ="Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & Server.MapPath("/BSP/Data/Shiny.mdb")
End Sub
</SCRIPT>

The big thing is that I'm not including "C:/Inetpub..." etc because I'm not on my computer, correct? This is for my ISP so I don't need to worry about that. Also, since I'm putting this in my root directory and there isn't a BSP folder, I'm going right to my Data folder, correct?
Try this on YOUR computer, it will work too :)
Server.MapPath will map a virtual directory to it's physical location :)
Yes on Data folder so:
Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & Server.MapPath("/Data/Shiny.mdb")

Have you been able to test any of this?
The ipower protocol had me document the path like this: C:/Accounts/bigshiny/wwwroot/Data/Shiny.mdb. Once that was in place, everything hummed just the way it should.

Thanks for the feedback!