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

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

  • Friday, December 14, 2007 4:58 AM
     
     

    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.

All Replies

  • Friday, December 14, 2007 7:04 AM
     
     Answered

    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 PM
    Moderator
     
     Answered

    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 PM
     
     

     

    Hello,

     

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

     

    Thanks.

  • Sunday, March 16, 2008 2:19 PM
     
     
    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 PM
     
     

    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 PM
     
     
    After changing the Authentication mode did you restart the Sql Service ?

    - Deepak
  • Sunday, March 16, 2008 5:20 PM
     
     

     

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

     

  • Saturday, April 18, 2009 3:05 AM
     
     
    Thank you, Madhu, It really helped me out. thanks alot :)
  • Thursday, July 16, 2009 7:23 AM
     
     
    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'."
  • Wednesday, March 17, 2010 8:52 PM
     
     
    Hi Zain,

    I am also getting same error and confirming that SQL Server is inmixed mode, still getting same exception. I got that you resolved this exception by view above URL send by 'ftpex' but unfortunate page not found.

    Please could you share here, how did you resolved it.? I will very thankful to you.

    Thanks,
    Dinesh
  • Tuesday, January 18, 2011 12:08 AM
     
     

    Step by step instructions on how to change authentication modes:

    http://www.hosting.com/support/vps/windows/mixedmode

  • Thursday, January 20, 2011 6:30 PM
     
     

    Hello,

    Read the following article which explains how to change the SQL Server Authentication Mode.

    Hope this helps!

    Cheers,
    Ashish

  • Wednesday, February 02, 2011 7:56 AM
     
     

    hi madhu

    i am sql 2008

    and i done already as per u said in ur last submission

    but still i am facing the same problem

    thanks in advance

  • Friday, August 12, 2011 6:07 PM
     
     
    Thanks for your resolve!!!
  • Wednesday, May 09, 2012 6:47 AM
     
     

    Worked for me..

    Thanks...


    Vallab