SQL Server Developer Center > SQL Server Forums > SQL Server Security > Login failed for user 'sa'. User not associated with a trusted SQL Server Connection.
Ask a questionAsk a question
 

AnswerLogin failed for user 'sa'. User not associated with a trusted SQL Server Connection.

  • Friday, December 14, 2007 4:58 AMsql20005 Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    Hi,

     

    I am trying to login to SQL Server 2005 using SQL Server authentication using 'sa'  account but it gives the below error

     

    'Login failed for user 'sa'. Not associated with trusted SQL Server Connection'

     

    The authentication mode set for the server was 'Windows Authentication' so i tried to change that to SQL Server and Windows Authentication but it didnt allow me to change the mode. It gives the below mentioned error.

     

    "An exception occured while executing the Transact SQL or Batch Statement.

    Execute permission denied on Object 'xp_instance_regwrite' , database 'mssqlsystemresource',schema 'sys' "

     

    Could you anyone kindly let me how to resolve this issue so that i can connect to the SQL Server using sa account.

     

    Thanks.

Answers

  • Friday, December 14, 2007 7:04 AMMadhu K NairMVPUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer

    Login as Local Administrator to your machine (SQL Server instance machine) and login to SQL Server instance using windows authentication.

    (a) Then change the Authenticaiton mode to SQL Server and WIndows (mixed mode)

    (b) Enable SA Login

    (c) Restart the service

     

    Madhu

  • Friday, December 14, 2007 3:36 PMrichbrownesqModeratorUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer

    Hopefully you still have a sysadmin account to access the server either through the local administrator account as Madhu suggested or one you have set up. Change the authentication as advised.

     

    There is a chance that the sa account is disabled (it is by default) so you may also need to enable this (right click the sa login, status, check enabled).

     

    HTH!

All Replies

  • Friday, December 14, 2007 7:04 AMMadhu K NairMVPUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer

    Login as Local Administrator to your machine (SQL Server instance machine) and login to SQL Server instance using windows authentication.

    (a) Then change the Authenticaiton mode to SQL Server and WIndows (mixed mode)

    (b) Enable SA Login

    (c) Restart the service

     

    Madhu

  • Friday, December 14, 2007 3:36 PMrichbrownesqModeratorUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer

    Hopefully you still have a sysadmin account to access the server either through the local administrator account as Madhu suggested or one you have set up. Change the authentication as advised.

     

    There is a chance that the sa account is disabled (it is by default) so you may also need to enable this (right click the sa login, status, check enabled).

     

    HTH!

  • Sunday, March 16, 2008 1:51 PMOri_ Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

     

    Hello,

     

    what do you mean by "enable sa login"? How do I enable a login?

     

    Thanks.

  • Sunday, March 16, 2008 2:19 PMDeepak RangarajanMVPUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    You can enable sa login using the below query. Execute it in SSMS,
    Code Snippet

    Alter login sa enable


    - Deepak
  • Sunday, March 16, 2008 2:48 PMOri_ Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    well I tried to change security mode to "Mixed" and tried to enabled my user's login but I still get the following error:

    Code Snippet

    java.sql.SQLException: Login failed for user 'sa'. The user is not associated with a trusted SQL Server connection.

     

     

    I will add that I'm using JDBC to access SQL Server 2005 Express. I also enabled the TCP protocol in the network configuration. Can someone help?

     

    Thanks.

     

  • Sunday, March 16, 2008 3:13 PMDeepak RangarajanMVPUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    After changing the Authentication mode did you restart the Sql Service ?

    - Deepak
  • Sunday, March 16, 2008 5:20 PMOri_ Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

     

    yes I did. I still got the same error
  • Thursday, April 10, 2008 7:59 PMftpex Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
  • Tuesday, October 21, 2008 6:27 PMRavinder Thumber Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Thank you, Madhu, This worked for me.

     

  • Saturday, April 18, 2009 3:05 AMZain Shaikh Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Thank you, Madhu, It really helped me out. thanks alot :)
  • Thursday, July 16, 2009 7:23 AMpunna Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    hai 
    i ahve also same problem 

    java.sql.SQLException: Login failed for user 'ccms'. what can i do 
    please hel to me   i have tried all the ways  mixed authentication and restart sql server  and all but i didt get connection 

    the error like 

    "java.sql.SQLException: Login failed for user 'ccms'."