sqlcmd not connecting - Msg 18456

One MS SQL Svr connects great, the other one does not.  What should I check/compare between the 2 ???


C:\Documents and Settings>sqlcmd -S SQLSVR01 -Uuser1
Password:
1> exit

C:\Documents and Settings>sqlcmd -S SQLSVR02 -Uuser1
Password: Msg 18456, Level 14, State 1, Server SQLSVR02, Line 1
Login failed for user 'user1'.



robjayAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Anthony PerkinsCommented:
>>What should I check/compare between the 2 ???<<
Does user1 exist in SQLSVR02 ?
0
vmartin86Commented:
Your problem most likely is somewhere within the connection string. A couple options to try would be copying the connection from the working database and then editing bits of information such as the table name and cells.

If you're devloping locally and then uploading to a server, perhaps using Microsoft's Visual Web Developer, often the web.config file will be pointing to wherever the database file was located for development. This is where Web Developer tries to help just a little too much in order to make sure your site / application can find the database.

For example:
        <add name="Connection Database" connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=C:\Documents and Settings\user\Desktop\database\DATABASE.mdf;Integrated Security=True;User Instance=True"
            providerName="System.Data.SqlClient" />

Should look something like this...
        <add name="Connection To Database" connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\DATABASE.mdf;Integrated Security=True;User Instance=True"
            providerName="System.Data.SqlClient" />
or
        <add name="Connection To Database" connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=DATABASE.mdf;Integrated Security=True;User Instance=True"
            providerName="System.Data.SqlClient" />
0
robjayAuthor Commented:
by looking at the SQL Server Logs, I was able to get the following specific error:

From the MSSMS Go to Management -> SQL Server Logs

04/16/2010 16:26:23,Logon,Unknown,Login failed for user 'user1'. Reason:
An attempt to login using SQL authentication failed. Server is
configured for Windows authentication only. [CLIENT: <local machine>]
04/16/2010 16:26:23,Logon,Unknown,Error: 18456<c/> Severity: 14<c/>
State: 58.

I needed to add SQL Server Authentication.  This is done by
1. Right click on the Server
2. Select  Properties
3. Select Security
4. Change Radio Button from Windows Authentication Mode to SQL Server
and Windows Authentication Mode
5. OK
6. Restart the SQL Server - this can be done by right clicking on the SQL Server and selecting the Restart option


0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft SQL Server

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.