0

I am new to sqlserver, I have a connection string as follows:

< add name="test" connectionString="server=dbServer\SQLEXPRESS;database=test;integrated security=SSPI;" />

and the site connects and works fine.

I created a user in SSMS 17.4, gave it a name

< add name="test" connectionString="server=dbServer\SQLEXPRESS;database=test;User Id=dbUser; Password=letmein;" />

the site fails saying "login failed for user 'dbUser'"

The user has following :

server roles: public, dbcreator

user mapping: default schema: dbo
database role memberships: db_owner, public

any idea why it fails on use of username/password?

Thanks

7
  • Check the SQL Server logs and post what the errors are in there, please. Commented Apr 24, 2018 at 11:56
  • 1
    'keyword not supported userid' when I take out the space Commented Apr 24, 2018 at 12:00
  • Can you connect with that account in SSMS? Commented Apr 24, 2018 at 12:01
  • ah, in the log, 'server is configured for integrated authentication only' Commented Apr 24, 2018 at 12:01
  • And there is you answer. :) Change the server to mixed authentication. Commented Apr 24, 2018 at 12:02

2 Answers 2

4

Likely causes include:

1) SQL instance is not configured to allow SQL auth

2) the login and/or password is wrong

3) the login does not have access their default database

Check the SQL Server error log as that will have more detailed info on the cause of the login failure. Those are not returned to the client for security reasons. The error log can be viewed from SSMS (Management-->SQL Server Logs) or via a text editor. The current log file is named "errorlog" (no extension) and located under the installation folder Log subdirectory by default.

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks, it was option 1:
1

Most probably you would not have configured your SQL Server authentication mode. enter image description here

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.