Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Old Forums
 CLOSED - General SQL Server
 SQLState: 28000

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2002-03-31 : 22:38:13
Sherry writes "I tried to start the osql utility by using "osql /U sa /S servername" at the command prompt. but I got the Login failed message"Login failed for user 'sa'. reason: Not associated with a trusted SQL Server connection" after I entered correct password for sa.

I also use "odbcping /S servername /U sa /P" at the command prompt. I got the following error message:

SQLState: 28000 Native Error: 18452
Info. Message:[Microsoft][ODBC SQL Server Driver][SQL Server]Login failed for user 'sa'. Reason: Not associated with a trusted SQL Server connection.

Would you please let me know how I can fix this problem? Thanks a lot.

Sherry"

efelito
Constraint Violating Yak Guru

478 Posts

Posted - 2002-04-01 : 12:31:12
Check the security settings on your SQL Server. It sounds like you have the authentication mode set to "Windows NT only". If you want to log in with the sa account, you'll need to change it to "SQL Server and Windows NT".

Jeff Banschbach
Consultant, MCDBA
Go to Top of Page

Nils
Starting Member

5 Posts

Posted - 2002-04-01 : 18:10:35
I had a similar problem as Sherry and I changed the authentication mode from "Windows NT Authentication" to "SQL Server + Windows NT". This change allowed me to successfully connect via 'osql' using the "sa" account. However, I cannot successfully connect using any NT accounts which I defined. For example, I created a Windows NT account "dbadmin" with a password. It was using this account that I installed and created the SQL 2000 database. This user id and password are shown as the "startup service account" in the Security tab of the Properties notebook for the server. Yet, I cannot connect to this server using 'osql' and userid 'dbadmin'. I get "Msg 18452: Login failed for 'dbadmin'. Not associated with a trusted SQL Server connection." On the other hand, when I execute Query Analyzer from the dbadmin userid, I am able to successfully connect, when I specify Windows NT authentication in the database connect dialog.
I have tried creating SQL Server logins unsuccessfully. If I create a login without a password, it works, but if I try to create one with a password, I get an error popup with the text: MS SQL-DMO Msg 552: CryptoAPI function 'CryptAcquireContext' failed. Invalid signature."
I heard a suggestion that I may have a corrupted or back level DLL. The server machine is Windows NT SP 5 which previously had MS SQL 6.5 installed. I first removed SQL 6.5 and then installed SQL 2000 (version 8.00.194). I had to remove SQL 6.5 manually because there was no choice in the SQL 6.5 program menu or in the Add/Remove application. The SQL 6.5 files were in different directories from the SQL 2000 files. How can I tell if I have corrupted files?
How can I get around the 18452 error using osql with a userid other than 'sa'? How can I get around the 552 error to define additional SQL serve login users with passwords?


Go to Top of Page

chadmat
The Chadinator

1974 Posts

Posted - 2002-04-02 : 00:53:03
Nils,

You must be logged in as the dbadmin account, and specify that you are using a trusted connection. You don't pass a user id and password, as NT authentication handles that for you. If you pass a user id and password, then you are trying to use a SQL Server account, and as you said, this is an NT account.

-Chad

Go to Top of Page

Nils
Starting Member

5 Posts

Posted - 2002-04-02 : 18:21:52
Chad,
I logged on the SQL Server as 'dbadmin'. The SQL server authentication mode was set to "SQL Server and Windows". I typed:

> osql -d<dbname>

The program prompted me for a password, even though I thought it was not supposed to do so. I entered the password for 'dbadmin', and the response was:

Login failed for user 'dbadmin'.

I then changed the server authentication mode to "Windows only" and retried the 'osql' command. Again, it prompted me for the password, even though I was already logged in as 'dbadmin'. When I entered the correct password, it responded:

Login failed for user 'dbadmin'. Reason: Not associated with a trusted SQL Server connection.

Then, I tried the following:

osql -E -d<dbname>

I was not prompted for a password, and I successfully got the SQL server prompt '>'. The -E option apparently bypasses trusted connections. This trick only seems to work when logged into the server as the 'dbadmin' account. When I am logged into another machine, using another account, which I defined to have permission to access the database, then even '-E' does not work.

Any idea about the Msg 552 CryptoAPI error in my previous posting?

-- Nils


Go to Top of Page

chadmat
The Chadinator

1974 Posts

Posted - 2002-04-03 : 01:59:17
-E uses trusted connections. That is why it works for dbadmin.

You say it doesn't work for other logins, what error do you get, and can you login to QA using these logins with a trusted connection?

I can lookup that error later, I can't do it now.

-Chad

Go to Top of Page

chadmat
The Chadinator

1974 Posts

Posted - 2002-04-04 : 02:20:47
Nils,

That error usually indicates a mismatch in encryption dlls (40/128).

You can try removing IE, then reinstalling the 128 bit version.

-Chad

Go to Top of Page

Nils
Starting Member

5 Posts

Posted - 2002-04-04 : 15:55:02
Chad,
I tried connecting to a different SQL 2000 server machine, running on Windows 2000. This time it worked. I was able to define a SQL Server login user with password, and I did not receive the 552 CryptoAPI errors. I was then able to connect to the database, both locally and remotely, using 'osql' and specifying the newly created SQL Server login user and password. I configured the server to use "Windows and SQL Server" authentication.
However, when I try to connect via 'osql' and a userid which is a Windows NT ID, and not a SQL Server ID, then I get "login failed" message. Given that the server is configured to accept Windows or SQL Server authentication, it shouldn't fail, right? Whatever the reason for the failure, I am satisfied for now being able to connect via a SQL Server login ID.
Thank you for your suggestion to remove/reinstall IE on the machine which is not working. I will try that later and let you know. Thanks for your help.
-- Nils


Go to Top of Page

chadmat
The Chadinator

1974 Posts

Posted - 2002-04-04 : 23:39:28
Nils,

you have to use -E with osql to use the NT Login (That you are currently logged in as).

You can never pass an NT login that is something different.

-Chad

Go to Top of Page
   

- Advertisement -