Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Baffled by server response! 1

Status
Not open for further replies.

Huitzilopochtli

Programmer
Feb 18, 2002
81
DE
Hello

Please help with this! I have a small Access DB in the same directory as the following ASP file. Is there any thing wrong with this short code, because the server tells me:

Microsoft OLE DB Provider for ODBC Drivers error '80004005'

[Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified

/db/odbc_exmp.asp, line 9


<% Response.buffer = true %>
<html>
<head>
<title>Stardeveloper.com Database Tutorial</title>
</head>
<body>
<% Dim rs
Set rs = Server.CreateObject (&quot;ADODB.Recordset&quot;)
rs.Open &quot;names&quot;, &quot;DSN=odbc_exmp&quot;,,, &H0200

While Not rs.EOF
Response.Write &quot;ID : &quot; & rs(&quot;id&quot;) & &quot;<br>&quot;
Response.Write &quot;First Name : &quot; & rs(&quot;first_name&quot;) & &quot;<br>&quot;
Response.Write &quot;Last Name : &quot; & rs(&quot;last_name&quot;) & &quot;<br>&quot;
Response.Write &quot;<br>&quot;
rs.MoveNext
Wend

rs.Close
Set rs = Nothing %>
</body>
</html>

What's wrong with line 9? I have repeated the DNS steps and uploaded the files again!

Many thanks!
 
I think that line 9 is reflecting a problem with the way you are opening the file. For example:

rs.Open &quot;names&quot;, &quot;DSN=odbc_exmp&quot;,,, &H0200

&quot;names&quot; should be the name of your source, but it's not referenced anywhere else. Is this the name of your access database?

Also, is your DSN connection right for an Access database? Those would be my first two guesses as to where to start looking for the problem. I don't know as much about connecting to an Access database, someone else might be able to help you there.
 
Hello Chopstick

Thank you for your reply.

Yes, you are on the right lines! I have since found out that the server at Brinkster (where the page and database is hosted) won't accept DND connected databases - hence the error.

Thanks for your time

Best wishes
 
Ok, I'll sound stupid here (especially since I'm still a newbie to a lot of this, particularly security). You're saying that if the access db is located in the same directory as the asp files, then it's possible for someone to download your access db? Is the same possible with other databases or can you elaborate? (It's for my own edification since I am going to have to start worrying about this on an upcoming project.) Thanks!
 
I believe so - I noticed this recently with the db in a subdirectory of my site so I moved the db up a directory above the website.

eg)
If your database was in the same directory as default.asp then you could download the database by entering the following in your browser (assuming you knew the name of the database):


If you relocate the database so it is not in the directory structure of your website then it is not accessible from the browser. Your ASP pages will all reference the database using an absolute path so it doesnt need to be with the rest of the site.

You could use the following structure:

c:\inetpub\c:\inetpub\
IIS or PWS would point to c:\inetpub\ as the location of the website.

I am assuming that the database is secure when it is placed above the site like this - if anyone thinks otherwise then I would be very grateful to hear about it.



Tony
 
I have a Brinkster account, and from memory they warn (for free a/c users) that your database is not secure, even in a subdirectory.

On a side note, the norm in Brinkster accounts (also from memory) is to put the database in the db subdirectory.

And yes, Brinkster doesn't offer DSN connections .. try something like

&quot;driver=Microsoft Access Driver (*.mdb);dbq=&quot; & Server.MapPath(&quot;/<youraccountname>/db/<yourdatabasename>.mdb>&quot;) codestorm
Fire bad. Tree pretty. - Buffy
select * from population where talent > 'average'
<insert witticism here>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top