"Not a valid password" error using ASP

R

rpowell

Hi, I have been opening password protected access 2003 databases with ASP /
ADO for years now. However now we have updated to office 2007 everything gone
bottoms up.

I have an access 2007 database (newly made, not converted from 2003), and a
fresh asp page. I've gotten the new connection string information for Access
2007 from the internet yet the page cannot open the database.

connection string being used:

sConnString="Provider=Microsoft.ace.OLEDB.12.0;Dat a Source=" & strPath &
";Jet OLEDB:Database PASSWORD= MyPassword"

When I try to open the page the error i get is - "Not a valid password" -
80040e4d. I'm 100% sure the password is correct, the driver is right (the
server has office 2007 installed, and the new access driver from the
Microsoft website). Every page i've seen on the internet says that the code
I'm using is correct, yet asp still can't open it.

If i remove the password from the database it opens fine, so it's not a
corrupt database, or bad path in the code. If i open the page on the server
it works though, if only fails when being accessed from another computer via
http.

If you can shed any light on my problem I would be eternally grateful - been
working on it for hours now!

Many thanks
Ryan
 
B

Brendan Reynolds

rpowell said:
Hi, I have been opening password protected access 2003 databases with ASP
/
ADO for years now. However now we have updated to office 2007 everything
gone
bottoms up.

I have an access 2007 database (newly made, not converted from 2003), and
a
fresh asp page. I've gotten the new connection string information for
Access
2007 from the internet yet the page cannot open the database.

connection string being used:

sConnString="Provider=Microsoft.ace.OLEDB.12.0;Dat a Source=" & strPath &
";Jet OLEDB:Database PASSWORD= MyPassword"

When I try to open the page the error i get is - "Not a valid password" -
80040e4d. I'm 100% sure the password is correct, the driver is right (the
server has office 2007 installed, and the new access driver from the
Microsoft website). Every page i've seen on the internet says that the
code
I'm using is correct, yet asp still can't open it.

If i remove the password from the database it opens fine, so it's not a
corrupt database, or bad path in the code. If i open the page on the
server
it works though, if only fails when being accessed from another computer
via
http.

If you can shed any light on my problem I would be eternally grateful -
been
working on it for hours now!

Many thanks
Ryan


Well the syntax appears to be correct (assuming that the space in the word
"Data" was just a typo in the newsgroup post). The following test worked for
me in VBA ...

Public Sub TestSub()

Dim strConnection As String
Dim cnn As ADODB.Connection

strConnection = "Provider=Microsoft.ACE.OLEDB.12.0;" & _
"Data Source=C:\Users\Brendan Reynolds\Documents\test.accdb;" & _
"Jet OLEDB:Database Password=test"

Set cnn = New ADODB.Connection
cnn.ConnectionString = strConnection
cnn.Open

Debug.Print cnn.State = adStateOpen

cnn.Close

End Sub

If the problem occurs only when running remotely, via HTTP, then two
possibilities occur to me. One is a permissions problem. Are you sure that
the identity under which the code is being executed has the necessary
permissions on the database and the folder where the database is stored? And
the other is perhaps the string is being HTML encoded? Spaces replaced with
%20, that sort of thing?
 
R

rpowell

Thanks for the reply.

It could be a permissions issue, but i've given the iusr_machinename account
full control of the database and containing folder, is there any other
permissions that should be set.

I'm using standard ASP not .net would this be an issue? The space was a
typo as well, be nice if it was just as simple as that!

As far as the html character encoding goes, i've tried replacing the spaces
with %20 and that causes an error, so the path itself is correct. If i
remove the database password the connection succeeeds. It's purely down to
the database password that is messing it up.

Cheers.
Ryan
 
B

Brendan Reynolds

rpowell said:
Thanks for the reply.

It could be a permissions issue, but i've given the iusr_machinename
account
full control of the database and containing folder, is there any other
permissions that should be set.

I'm using standard ASP not .net would this be an issue? The space was a
typo as well, be nice if it was just as simple as that!

As far as the html character encoding goes, i've tried replacing the
spaces
with %20 and that causes an error, so the path itself is correct. If i
remove the database password the connection succeeeds. It's purely down
to
the database password that is messing it up.


I never did much with ASP 'classic', and none of it recent, so I'm afraid I
can't be any more specific, other than to suggest that you try to double
check that iusr_machinename account is the account under which the code is
executing. But then, if the code works when you remove the password, that
would seem to indicate that the account does have the necessary permissions
on the database and folder, anyway.

As for the HTML encoding suggestion, are there any non-alphanumeric
characters in the password itself that might be encoded?
 
R

rpowell

Thanks Brendan for your response. I've tried changing the password to a
simple work rather than a strong multi-character / multi-case password and
the error is still occuring.

I've now created a brand new database and a new ASP page on another computer
(this time XP pro running IIS 5) and the error is still happening. I'm
wondering if it is somthing to do with invalid code as far as inputting the
password to the database upon connection.

The code im using is --
objConnection.Properties("Jet OLEDB:Database Password") = "#Si76=t*"
--
Can you confirm that is correct, mainly it being JET, is there a new
property i'm not familiar with, something along the lines of "Jet OLEDB:
Database Encrypted Password"? It seems odd I'm getting the error on multiple
computers and with multiple databases.

Many thanks for your help!
Ryan
 
B

Brendan Reynolds

rpowell said:
Thanks Brendan for your response. I've tried changing the password to a
simple work rather than a strong multi-character / multi-case password and
the error is still occuring.

I've now created a brand new database and a new ASP page on another
computer
(this time XP pro running IIS 5) and the error is still happening. I'm
wondering if it is somthing to do with invalid code as far as inputting
the
password to the database upon connection.

The code im using is --
objConnection.Properties("Jet OLEDB:Database Password") = "#Si76=t*"
--
Can you confirm that is correct, mainly it being JET, is there a new
property i'm not familiar with, something along the lines of "Jet OLEDB:
Database Encrypted Password"? It seems odd I'm getting the error on
multiple
computers and with multiple databases.

Many thanks for your help!
Ryan


The property name seems to be valid, Ryan. I tried changing my original test
code to set the property as in your example, instead of including it in the
connection string as in my original example, and the code still executes
successfully, just as it did before the change. Here's the modified test
code (with the original connection string assignment commented out for
reference).

Public Sub TestSub()

Dim strConnection As String
Dim cnn As ADODB.Connection

' strConnection = "Provider=Microsoft.ACE.OLEDB.12.0;" & _
' "Data Source=C:\Users\Brendan Reynolds\Documents\test.accdb;" & _
' "Jet OLEDB:Database Password=test"

strConnection = "Provider=Microsoft.ACE.OLEDB.12.0;" & _
"Data Source=C:\Users\Brendan Reynolds\Documents\test.accdb;"

Set cnn = New ADODB.Connection
cnn.ConnectionString = strConnection
cnn.Properties("Jet OLEDB:Database Password") = "test"
cnn.Open

Debug.Print cnn.State = adStateOpen

cnn.Close

End Sub
 
R

rpowell

Thanks for the reply again Brendan. I translated the function you provided
from ASP.net to Classic ASP because I have no experience in .Net, something
I'll have to learn i suppose. I'm still getting an invalid password error...
--
Microsoft Office Access Database Engine error '80040e4d'

Not a valid password.

/bpbes/Assets/Scripts/dbConnect.asp, line 17
--
Line 17 is cnn.open. Looks as though I wont be able to get this to work.
The code you're providing is the same code i've found when searching google
so the validity of the code isn't in question, it must just be a classic asp
or a server problem.

Any other suggestions? If not i'll have to break out the ASP.Net books!
Cheers
Ryan
 
B

Brendan Reynolds

I'm afraid I'm out of ideas, Ryan. The code I posted was actually VBA code
that I tested in the Access VBA editor, not .NET code, but I don't think
that should make any difference. Ultimately, what we're doing is setting a
property of the ADO connection, and it's the same ADO connection, with the
same properties, regardless of which technology we're using to access it.

Good luck, I hope you find a solution.
 
M

MKM

Hi Ryan--
it's not you, it's the software. I have been researching the same issue,
except my situation is much less complucated than yours. I have a local
..accdb, plain old forms, queries and reports...nothing special. I split my
database then set a password on the _be.accdb and am now getting the same
error. I believe it is a bug in the software. Another user responded to a
previous post of mine with some connection string code, but the point is, if
you use a wizard to do a thing then you shouldn't be required to write code
to make it work. I haven't even tried the code, so I don't yet know if it
will work. Good luck!

MKM
 
M

MKM

one more thing; this just in from the other post on my issue.

delete all the links in the FE and re-link. You will be asked for the _be
password, but after that you are good to go. Worked for me, at least.

MKM
 

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

Top