ASP Classic: Problems when trying to connect to a database.

S

schurst30

Hi, I am currently trying to get back into ASP and have begun looking at an
old webpage I developed some years ago, it was fully functional back in 2002
and I had it up and running with no problems. I have just recently bought a
new PC with Windows Vista Home Premium on it and installed IIS. When I try
and connect to my data base I get the following error message retunred:


Microsoft OLE DB Provider for ODBC Drivers error '80004005'

[Microsoft][ODBC Microsoft Access Driver] Disk or network error.

/joynermorgan/take_registration.asp, line 50


Line 50 looks like this:

writeDB.Open "joynerm"

joynerm is the system DSN that I created to connect to my database.

The following is the actual code from the file take_registration.asp where
the error is occuring:

<%
if p_password1 = p_password2 then

set writeDB = Server.CreateObject ("ADODB.Connection")
writeDB.Open "joynerm"

sqlText = "select * from members where username = '"& p_username &"'"
set userSet = DataBase.Execute (sqlText)

if userSet.EOF then

userSet.Close
set userSet = Nothing

theSQL = "insert into members"
theSQL = theSQL & " (username, pass, first_name, last_name, email) "
theSQL = theSQL & "values '"&p_username&"', '"&p_password1&"',
'"&p_firstname&"', '"&p_lastname&"', '"&p_email&"')"

end if

DataBase.Execute (theSQL)

DataBase.Close
set DataBase = Nothing



Response.Write "<h2 class='heading'>User Registration</font></h2>"
Response.Write "<p>Thank you for your registration, if you wish you may
now <a href='/joynermorgan/index.asp'>go home</a>."

else

Response.Redirect "/joynermorgan/register.asp?retry=usernameunavail"

end if

%>

I am fully aware that my coding techniques are out of date and therefore
will seem a little strange but as I said before, when I had this website up
and running some 5 years ago I never had a problem with this code at all.

Does anybody have any suggestions as to what could be the problem here?

Any help given would be much appreciated.

Many thanks in advance.

Spencer
 
B

Bob Barrows [MVP]

schurst30 said:
Hi, I am currently trying to get back into ASP and have begun looking
at an old webpage I developed some years ago, it was fully functional
back in 2002 and I had it up and running with no problems. I have
just recently bought a new PC with Windows Vista Home Premium on it
and installed IIS.

Really? I don't use Vista, but I had been under the impression that IIS
would not run on the Home edition.
When I try and connect to my data base I get the
following error message retunred:


Microsoft OLE DB Provider for ODBC Drivers error '80004005'

[Microsoft][ODBC Microsoft Access Driver] Disk or network error.

/joynermorgan/take_registration.asp, line 50


Line 50 looks like this:

writeDB.Open "joynerm"

joynerm is the system DSN that I created to connect to my database.

The following is the actual code from the file take_registration.asp
where the error is occuring:
<none of which is relevant>

This is most likely to be a permissions problem. All users of an Access
database require Modify (read/write/create/delete) permission on the
folder containing the database file. The "gotcha" is that the "user" in
IIS may not be you, depending on how you have your website configured.
If Anonymous access is enabled, then the "user" is the Internet Guest
Account (aka IUSR_machinename). So if you have not granted the IUSR
account permissions for that folder, your asp page will not be able to
make the connection.

See here for more: http://www.aspfaq.com/show.asp?id=2009

Also, it's got nothing to do with your problem, but you should stop
using the obsolete ODBC DSN. See:
http://www.aspfaq.com/show.asp?id=2126
 
E

Evertjan.

Bob Barrows [MVP] wrote on 20 aug 2007 in
microsoft.public.inetserver.asp.general:
Really? I don't use Vista, but I had been under the impression that IIS
would not run on the Home edition.

IIS doesn't under "Home-Basic", but does under "Home-Premium".
 
S

schurst30

Thanks for your input Bob, I have checkedc the permissions settings for all
folders in wwwroot and the users, creator, system etc is all set to full
control for now? Does this rule out the fact that it could be a permissions
problem?

I did change the way I connect to the way you suggested which throws up a
different error message as follows:


Microsoft JET Database Engine error '80004005'

Unspecified error

/joynermorgan/take_registration.asp, line 54
 
B

Bob Barrows [MVP]

Evertjan. said:
Bob Barrows [MVP] wrote on 20 aug 2007 in
microsoft.public.inetserver.asp.general:


IIS doesn't under "Home-Basic", but does under "Home-Premium".
Ah, did miss the "Premium" part ...
 
B

Bob Barrows [MVP]

schurst30 said:
Thanks for your input Bob, I have checkedc the permissions settings
for all folders in wwwroot and the users, creator, system etc is all
set to full control for now?

Overkill. The only folder that needs attention is the folder containing
the mdb file
Does this rule out the fact that it
could be a permissions problem?

I don't know - did your sweeping efforts include the folder containing
the mdb file? Did they include granting permission for the IUSR account?
Is your website set to Anonymous access?
 
S

schurst30

Bob,

Anonymous Authentication is enabled, the folder where the .mdb files is
located has the correct permissions associated with the IUSR account etc.

Still having no joy in everything I try.

Spencer
 
B

Bob Barrows [MVP]

It's probably not a coding issue (I would like to see what you changed
your connection string to. It should contain the filesystem path to the
mdb file, not a url). Unfortunately, I don't have a machine with Vista
installed so I cannot test whether it's a Vista issue.
I'm assuming you are able to open the database in Access, correct?

Let's take ASP out of the picture. Create a file called testmdb.vbs
containing the following lines of code:

dim cn
set cn=createobject("adodb.connection")
cn.open "Provider=microsoft.jet.oledb.4.0;" & _
"data source=p:\ath\to\mdbfile.mdb"
cn.close

Save the file and double-click it to run it - any errors?


Oh! You have installed the Jet components on the machine, I hope?
And are you running the 64-bit version of Vista? if so you have to
configure IIS to run in 32-bit mode.
 
T

ThatsIT.net.au

schurst30 said:
Bob,

Anonymous Authentication is enabled, the folder where the .mdb files is
located has the correct permissions associated with the IUSR account etc.

Still having no joy in everything I try.


You dont have the database open do you?
your error occers iof you dont have permissions or if you have the database
open

http://support.microsoft.com/kb/306269
 
S

schurst30

I created that file and it thre up an error:

Line 3
Char 1
Error: 'p:\ath\to\mdbfile.mdb' is not a valid path. Make sure that the path
name is spelled correctly and that you are connected to the server on which
the file resides.
Code: 80004005
Source: Microsoft JET Database Engine

I am running the 32 bit Vista so that shouldn't be a problem, I do not know
if the JET files are installed? This could be an issue, how do I check/do
this?

Many Thanks

Spencer
 
S

schurst30

Apologies for this, I changed the path to that where my database is and the
script never threw up any errors at all?! What could this mean?
 
B

Bob Barrows [MVP]

Thanks for the belly laugh :)

It means
1. Jet is properly installed and
2. You still have a permissions problem.

You may need to grant permission to the IWAM account as well as the IUSR
account, especially if that code you posted is being run in global.asa.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,043
Latest member
CannalabsCBDReview

Latest Threads

Top