Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP 3 Classic ASP Active Server Pages 3.0 > Classic ASP Databases
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old March 20th, 2004, 05:19 PM
Registered User
 
Join Date: Mar 2004
Location: Humphrey, NE, USA.
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to Caley L. Baumgart
Default 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

Reply With Quote
  #2 (permalink)  
Old March 20th, 2004, 08:52 PM
Friend of Wrox
 
Join Date: Jun 2003
Location: Harrisburg, PA, USA.
Posts: 1,998
Thanks: 0
Thanked 3 Times in 3 Posts
Default

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
Reply With Quote
  #3 (permalink)  
Old March 21st, 2004, 04:52 AM
Registered User
 
Join Date: Mar 2004
Location: Humphrey, NE, USA.
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to Caley L. Baumgart
Default

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.

Reply With Quote
  #4 (permalink)  
Old March 22nd, 2004, 05:03 AM
Friend of Wrox
 
Join Date: Oct 2003
Location: colombo, WP, Sri Lanka.
Posts: 481
Thanks: 0
Thanked 3 Times in 3 Posts
Send a message via MSN to surendran Send a message via Yahoo to surendran
Default

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)
Reply With Quote
  #5 (permalink)  
Old March 22nd, 2004, 10:57 AM
Friend of Wrox
 
Join Date: Jun 2003
Location: Harrisburg, PA, USA.
Posts: 1,998
Thanks: 0
Thanked 3 Times in 3 Posts
Default

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.
Reply With Quote
  #6 (permalink)  
Old March 22nd, 2004, 11:24 AM
planoie's Avatar
Friend of Wrox
Points: 16,481, Level: 55
Points: 16,481, Level: 55 Points: 16,481, Level: 55 Points: 16,481, Level: 55
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2003
Location: Clifton Park, New York, USA.
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

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.
Reply With Quote
  #7 (permalink)  
Old March 22nd, 2004, 06:26 PM
Registered User
 
Join Date: Mar 2004
Location: Humphrey, NE, USA.
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to Caley L. Baumgart
Default

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... :)

Reply With Quote
  #8 (permalink)  
Old March 23rd, 2004, 11:53 AM
planoie's Avatar
Friend of Wrox
Points: 16,481, Level: 55
Points: 16,481, Level: 55 Points: 16,481, Level: 55 Points: 16,481, Level: 55
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2003
Location: Clifton Park, New York, USA.
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

Sounds like it's time to switch web hosts.
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
ASP Insert , MS Access Db tigere Classic ASP Databases 0 November 11th, 2006 08:43 AM
VB. NET MS Access 2003 OLEDB connection mike.cody ASP.NET 1.0 and 1.1 Basics 1 February 22nd, 2006 08:20 PM
Error in Asp,net and MS Access DB shankha ADO.NET 1 January 4th, 2006 12:00 PM
OLEDB with ASP.NET and MS Access DB krishanu Classic ASP Databases 0 June 8th, 2005 12:52 PM
Access DB Connection (Jet cannot Open) M.L.Srinivas Classic ASP Databases 7 October 8th, 2003 08:21 AM



All times are GMT -4. The time now is 06:12 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.