 |
| Classic ASP Databases Discuss using ASP 3 to work with data in databases, including ASP Database Setup issues from the old P2P forum on this specific subtopic. See also the book forum Beginning ASP.NET Databases for questions specific to that book. NOT for ASP.NET 1.0, 1.1, or 2.0. |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the Classic ASP Databases section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
|
|
|
|

March 20th, 2004, 05:19 PM
|
|
Registered User
|
|
Join Date: Mar 2004
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Need HELP, MS access DB, Jet OLEDB, asp
Need help connecting to access database on web server.
this is an excerpt of the code from the results.htm file located from the root:
\gas_interface\results\results.htm
the database is located from the root:
\fpdb\gas.mdb
I need to get access to it using server.mapath() probably, but I am not sure. I know that the Jet.OLEDB 4.0 wants the data source= to be entered as a UNC path, but if i enter it for the webhosting server, it points it to my computer.
Here is the code:
==================================================
Provider=Microsoft.Jet.OLEDB.4.0;User ID=Admin;Data Source=C:\Documents and Settings\Caley\Desktop\Gas\fpdb\gas.mdb;Mode=Share Deny None;Extended Properties="";Persist Security Info=False;Jet OLEDB:System database="";Jet OLEDB:Registry Path="";Jet OLEDB:Database Password="";Jet OLEDB:Engine Type=0;Jet OLEDB:Database Locking Mode=1;Jet OLEDB:Global Partial Bulk Ops=2;Jet OLEDB:Global Bulk Transactions=1;Jet OLEDB:New Database Password="";Jet OLEDB:Create System Database=False;Jet OLEDB:Encrypt Database=False;Jet OLEDB:Don't Copy Locale on Compact=False;Jet OLEDB:Compact Without Replica Repair=False;Jet OLEDB:SFP=False
================================================
 Caley
|
|

March 20th, 2004, 08:52 PM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 1,998
Thanks: 0
Thanked 3 Times in 3 Posts
|
|
Try using Server.MapPath("\fpdb\gas.mdb"), that should work. Not sure what you mean by "but if i enter it for the webhosting server, it points it to my computer". How so?
Brian
|
|

March 21st, 2004, 04:52 AM
|
|
Registered User
|
|
Join Date: Mar 2004
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
I mean the exact server path is d:\website\69.68.25.82\gas\fpdb\gas.mdb, but this in IE will point to the d drive on my computer.... so I need code to change the:
==================================================
Provider=Microsoft.Jet.OLEDB.4.0;User ID=Admin;Data Source=C:\Documents and Settings\Caley\Desktop\Gas\fpdb\gas.mdb;Mode=Share Deny None;Extended Properties="";Persist Security Info=False;Jet OLEDB:System database="";Jet OLEDB:Registry Path="";Jet OLEDB:Database Password="";Jet OLEDB:Engine Type=0;Jet OLEDB:Database Locking Mode=1;Jet OLEDB:Global Partial Bulk Ops=2;Jet OLEDB:Global Bulk Transactions=1;Jet OLEDB:New Database Password="";Jet OLEDB:Create System Database=False;Jet OLEDB:Encrypt Database=False;Jet OLEDB:Don't Copy Locale on Compact=False;Jet OLEDB:Compact Without Replica Repair=False;Jet OLEDB:SFP=False
================================================
to something that will direct it to the local webhost server db.
|
|

March 22nd, 2004, 05:03 AM
|
|
Friend of Wrox
|
|
Join Date: Oct 2003
Posts: 479
Thanks: 0
Thanked 3 Times in 3 Posts
|
|
Sub Session_OnStart
Dim sDB, sPath, sDSNDir, sDSNFil, sDefDir, sDSN, sScriptDir
sDB = "database.mdb"
sScriptDir = Request.ServerVariables("SCRIPT_NAME")
sScriptDir = StrReverse(sScriptDir)
sScriptDir = Mid(sScriptDir, InStr(1, sScriptDir, "/"))
sScriptDir = StrReverse(sScriptDir)
sPath = Server.MapPath(sScriptDir) & "\"
sPath="C:\Database\"
sDSN = "DBQ=" & sPath & sDB & ";Driver={Microsoft Access Driver (*.mdb)}"
Session("Dataconn_ConnectionString") = sDSN
Session("Dataconn_ConnectionTimeout") = 30
Session("Dataconn_CommandTimeout") = 45
Session("Dataconn_CursorLocation") = 3
Session("Dataconn_RuntimeUserName") = ""
Session("Dataconn_RuntimePassword") = ""
End Sub
surendran
(Anything is Possible)
|
|

March 22nd, 2004, 10:57 AM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 1,998
Thanks: 0
Thanked 3 Times in 3 Posts
|
|
You need to change d:\website\69.68.25.82\gas\fpdb\gas.mdb to \\servername\path... If you need to reference a drive on the server, i think you can do \\servername\d$, or something like that.
|
|

March 22nd, 2004, 11:24 AM
|
 |
Friend of Wrox
|
|
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
|
|
The pages are on the webhosting server. Is the database there as well? Is the database in a directory relative to the root of your web application? On my web host, they give me a data directory to put my MDB files in. So when I need to refer to the database file, I use Server.MapPath("/data/mydatabase.mdb"). Without knowing the exact physical file path of the host's server I can't explicitly tell the data provider where to get it. That what MapPath is for.
|
|

March 22nd, 2004, 06:26 PM
|
|
Registered User
|
|
Join Date: Mar 2004
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Hmm...well... it seems my webhosting company doesn't allow for data access pages because they pose a security threat.  Guess I will have to do some workarounds...
Thanks for all the help guys... :)
|
|

March 23rd, 2004, 11:53 AM
|
 |
Friend of Wrox
|
|
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
|
|
Sounds like it's time to switch web hosts.
|
|
 |