Take the 2-minute tour ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

Alright, I have a classic asp application and I have a connection string to try to connect to db.

MY connection string looks as follows:

 Provider=SQLOLEDB;Data Source=MYPC\MSSQLSERVER;Initial
 Catalog=mydb;database=mydb;User Id=me;Password=123

Now when I'm accessing db though front-en I get this error:

Microsoft OLE DB Provider for SQL Server error '80040e4d'
Login failed for user 'me'. 

I looked in the sql profiler and I got this:

 Login failed for user 'me'.  Reason: Password did not match that
 for the login provided. [CLIENT: <named pipe>]
 Error: 18456, State:8. 

What I've tried:

*checked 100 times that my password is actually correct.
*Tried this: alter login me with check_policy off (Do not even know why I did this)
*Enable ALL possible permissions for this account in SSMS. * I've tried this connection string: Provider=SQLOLEDB;Data Source=MYPC\MSSQLSERVER;Initial Catalog=mydb;database=mydb; Integrated Security = SSPI

And I got this error:

Microsoft OLE DB Provider for SQL Server error '80004005' Cannot open database mydb requested by the login. The login failed.
share|improve this question

2 Answers 2

The only times I have ever seen the State 8 error for 18456 (Password Mismatch) was in fact a password mismatch. Try a new password. Type it in notepad, copy and paste it to SQL and then do the same into your app config. Make sure nothing is happening to that password when it is being handed off to SQL - no trimming, extra spaces, etc.

But then the second error you got seems to indicate you may have gotten past that bad password error and are now unable to access your database.

That can be one of a few things:

1.) Verify the database specified really does exist. 2.) Verify that the login you are using has been granted appropriate permissions into that database (If the permissions are at the SQL Server system administrator level then this shouldn't be a necessary step)

That's where I'd start anyway.

share|improve this answer
    
I already did everything mentioned above. no success :( –  user4079 Oct 25 '11 at 3:05
    
So you can log in fine with SQL Server Management Studio with that user and password? –  Mike Walsh Oct 25 '11 at 3:18
    
yes. I actually can do that in ssms. –  user4079 Oct 25 '11 at 4:13
    
and no errors whatsoever? That's a really interesting one because normally those two error state are more or less clear cut. have you tried to change the password to something really simple? –  Mike Walsh Oct 25 '11 at 4:31
2  
You can't use wireshark to monitor the authentication part of the process. Authentication is encrypted using SSL via a self signed certificate. –  mrdenny Oct 26 '11 at 7:47

Why are you specifying "Initial Catalog=mydb;database=mydb;"? You should be using one or the other, not both.

Your connection string should look like this.

Provider=SQLOLEDB;Data Source=MYPC\MSSQLSERVER;Initial Catalog=mydb;User Id=me;Password=123
share|improve this answer
    
Just tried. The same error –  user4079 Oct 26 '11 at 15:57
1  
Is the instance case sensitive? Try removing the Initial Catalog section and see if you can connect to the database instance. You'll probably get missing object errors unless the login is setup with the correct default database on the instance, but we need to make sure you can just connect correctly at this point. –  mrdenny Oct 26 '11 at 16:30

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.