The user is not associated with a trusted SQL Server connection

  • I'm sure you're all sick of seeing threads on this error... and I've read bunches of them... but none of them address my situation.

    I have a simpleton vbscript logon script that makes a connection to a SQL 2005 server using a SQL LOGIN ACCOUNT... not a windows account. The SQL Server is setup for MIXED MODE... it will accept either windows or sql logins.

    When I, as a member of Domain Admins, which makes me a local Administrator, logs on... the script runs fine... no errors... logs the data as it should. When my users log in... the script throws the error:

    Login failed for user '' ..... Sql Server, Error: 18452 (The user is not associated with a trusted SQL Server connection)

    Now... I've already pointed out this script uses a SQL account to connect to the database... so why am I getting this error... and only getting it for non-administrator users? Why would the SQL connection care whether the user is a local administrator or not if it is using a SQL account to make the connection?

    Thanks for the read...

  • have you checked if the user is orphaned user or not.

    Run this

    sp_change_users_login 'report'.

    Please provide result.

    ----------
    Ashish

  • The error message would indicate that you are connecting using a trusted connection, not a SQL logon. Can you post the connection string the application is using?

    Can you login with SSMS using the users credentials ?

  • Running the sp_change_users_login 'report' returned no results. Ran against master DB.

  • It need to be run in the database where you have the problem.

    For more detail please have a read of :- http://msdn.microsoft.com/en-us/library/ms174378.aspx

    ----------
    Ashish

  • Ian -

    Here is the connection string: sConn = "Driver={SQL Server};Server=SERVER-FQDN\SQLINSTANCE;Database=DN_NAME;Username=VALIDUSERNAME;Password=PASSWORD;"

    I have tried both a valid SQL account and I tried with 'sa'... neither works.

    I'm using a sql account as these users/desktops are in a remote domain... and I have no trust setup between the domains.

    Again: If I log onto the desktop as an Admin, the connection works... if I log on as a non-admin user... I get the error.

    Since I'm using a sql account in the connection string... and not using trusted in any way... I can't understand why non-admin users aren't connecting.

    As a side note: my Admin account in both domains is the same (username & password) so passthrough authentication is in play.. but it should not affect a strictly SQL-Centric connection string should it?

  • crazy4sql - Still no results when run against the target database

  • ok, so it confirmed that its not orphaned account.

    Next thing I would like to check if the account have correct permission on database level. Seems like as soon someone login through application, it have some security checks or some auditting which need to be executed and the account not have the permission for that.

    Try giving the DB_Owner permission to account first and then connect from application side.If it succeed then keep trying with reducing the access rights.....

    ----------
    Ashish

  • Yes it has the correct permissions in SQL. As I've previously noted... when I login with my Admin account... the sql connection connects and the data is stored. When I connect with a user account... the error occurs and no data is stored. Both attempts run the exact same script and connection with the exact same connection string... one connects... one fails.

    This mean the sql account is valid... the permissions are valid... the database is valid... a connection is possible... data can be stored using this script.

    Now here is the weirdness... The workstations are in a separate domain and there is no trust between the domains... so windows authentication is not an option.

    My primary user account is identical in both domains... and it works when I log on. But when I login with a user account in the workgroup domain that does not exist in the sql domain... I get the error.

    But Why? My connection string uses SQL Login... not a Windows Login. So why does it appear to be dependant on a Windows Account? What I am trying to do is not different that a website making a SQL connection using a SQL Account... since IUSR is not trusted in SQL (or shouldn't be :).

    Here is my connection string:

    sConn = "Driver={SQL Server};Server=SERVER_FQDN\SQLINSTANCE;Database=DN_NAME;Username=VALIDUSERNAME;Password=PASSWORD;"

  • "Driver={SQL Server};Server=SERVER-FQDN\SQLINSTANCE;Database=DN_NAME;Username=VALIDUSERNAME;Password=PASSWORD;"

    Check out this link http://www.connectionstrings.com/sql-server-2005

    It's possible that the username keyword in your connection string is invalid, and SQL Server is therefore defaulting to a trusted connection.

  • Ian - 😎YOU ARE THE MAN!!😎

    Thanks so much for the help. :w00t:

Viewing 11 posts - 1 through 11 (of 11 total)

You must be logged in to reply to this topic. Login to reply