Wrox Programmer Forums

Need to download code?

View our list of code downloads.

| 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 August 20th, 2003, 02:18 PM
Authorized User
 
Join Date: Aug 2003
Location: , , .
Posts: 43
Thanks: 0
Thanked 0 Times in 0 Posts
Default mapping a database.

Hey,

I have been testing my asp pages locally. I have been using a connection string
<% strConnect = Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\sbdc.mdb;Persist Security Info=False %> and then just do as an include# file on my other pages. So it has been working fine.

Now i uploaded it on my server that is on another machine basically testing it on a browser, I dont know how to set up the connection to the database. I read that I should use a map path, but i dont how.

Reply With Quote
  #2 (permalink)  
Old August 20th, 2003, 02:33 PM
Authorized User
 
Join Date: Aug 2003
Location: , , .
Posts: 43
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Do i just use this ?? Change out scservices.mdb and list.mdb to name of my database?

'strConnect="DBQ=" & Server.Mappath("scservices.mdb") & ";Driver={Microsoft Access Driver (*.mdb)};"

'strConnect = "Driver={Microsoft Access Driver (*.mdb)}; DBQ=database/list.mdb"

Reply With Quote
  #3 (permalink)  
Old August 20th, 2003, 03:11 PM
Authorized User
 
Join Date: Aug 2003
Location: , , .
Posts: 43
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Another weird thing is that when i try to load up the ASP page, it keeps popping up a dialog box asking if i want to open or save it to my computer?!! im clueless! =p

Reply With Quote
  #4 (permalink)  
Old August 21st, 2003, 03:26 AM
Friend of Wrox
 
Join Date: Jun 2003
Location: , , United Kingdom.
Posts: 1,212
Thanks: 0
Thanked 1 Time in 1 Post
Default

The format of the connection string does not need to change, just the path in the DataSource part. For ASP, you should definitely use the Jet OLEDB provider (your first version) not the Access ODBC driver (your second version).

Did you move your ASP to the new server too, or are you now trying to connect from ASP on one machine to an Access db on another server?
Reply With Quote
  #5 (permalink)  
Old August 21st, 2003, 04:18 AM
Authorized User
 
Join Date: Aug 2003
Location: , , .
Posts: 43
Thanks: 0
Thanked 0 Times in 0 Posts
Default

yea, i basically uploaded everything to the server. So, what you're saying is that i should just use this:

'strConnect="DBQ=" & Server.Mappath("scservices.mdb") & ";Driver={Microsoft Access Driver (*.mdb)};"

If that is the case then something is wrong with my server, because it keeps prompting me "if i want to save the file or open it because opening files may damaged your computer... etc". Im using dreamweaver by the way.

Reply With Quote
  #6 (permalink)  
Old August 21st, 2003, 04:45 AM
Friend of Wrox
 
Join Date: Jun 2003
Location: , , United Kingdom.
Posts: 1,212
Thanks: 0
Thanked 1 Time in 1 Post
Default

No, do not use that driver, use the OLEDB driver.
<% strConnect = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\sbdc.mdb;Persist Security Info=False" %>

Maybe you'd better post some more code - simply connecting to your db should not cause it to be downloaded to the client. A separate issue is that your db should always be located outside of the web root so that it cannot be downloaded by the client.
Reply With Quote
  #7 (permalink)  
Old August 21st, 2003, 10:06 AM
Registered User
 
Join Date: Aug 2003
Location: , , USA.
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default

You need to make sure that IIS is configured to server asp documents. If not the server does not know what to do with the file and sends it to the client.

Reply With Quote
  #8 (permalink)  
Old August 21st, 2003, 11:01 AM
Authorized User
 
Join Date: Aug 2003
Location: , , .
Posts: 43
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Microsoft JET Database Engine error '80004005'

Could not find file 'C:\sbdc.mdb'.

/!new/form2.asp, line 7


I dont understand why it keeps on saying c:\... Its not even in my string connection...
<% strConnect = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=sbdc.mdb;Persist Security Info=False" %>


Reply With Quote
  #9 (permalink)  
Old August 21st, 2003, 11:04 AM
Authorized User
 
Join Date: Aug 2003
Location: , , .
Posts: 43
Thanks: 0
Thanked 0 Times in 0 Posts
Default

The error is from when I am trying to view it in the browser from my server....

I fixed the other error how my server was not configured to look at ASP pages, and it kept on showing me just play ASP code when i was trying to load up asp pages. thanks for catching it.

Reply With Quote
  #10 (permalink)  
Old August 21st, 2003, 11:11 AM
Authorized User
 
Join Date: Aug 2003
Location: , , .
Posts: 43
Thanks: 0
Thanked 0 Times in 0 Posts
Default

AHhhh.. i finally figured it out. I used this connection string on a server that processes ASP pages and it finally worked.


strConnect="DBQ=" & Server.Mappath("scservices.mdb") & ";Driver={Microsoft Access Driver (*.mdb)};"

Thanks guys.

1. Okay let me get this straight... When i do my site locally I use this: <
% strConnect = Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\sbdc.mdb;Persist Security Info=False %>

2. And when my database is on a hosting server the string should be this:
strConnect="DBQ=" & Server.Mappath("scservices.mdb") & ";Driver={Microsoft Access Driver (*.mdb)};"

3. So whats this for????
'strConnect = "Driver={Microsoft Access Driver (*.mdb)}; DBQ=database/list.mdb"

4. I can also connect using a DSN right, but i need the admin to set that up for me?

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
Many-to-Many Relationships in O/R Mapping sarosh Classic ASP Databases 0 December 8th, 2006 05:45 AM
Problems with mapping mauriciom Biztalk 2 August 16th, 2006 06:47 AM
Character Mapping muki XSLT 2 November 11th, 2005 03:11 AM
O/R mapping s_sana General .NET 0 April 12th, 2005 06:34 AM
Mapping SID Anantsharma SQL Server 2000 2 February 10th, 2005 05:32 AM



All times are GMT -4. The time now is 01:11 PM.


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