SQL Server Performance

Login failed for user '(null)'

Discussion in 'Getting Started' started by dkusum_4, Oct 8, 2007.

  1. dkusum_4 New Member

    Login failed for user '(null)' I need to connect remotely to MS SQL Server 2000 using php.I am using the following codes:$dbhost = "IP address of server"; $dbuser = "username"; $dbpass = "password";mssql_connect($dbhost, $dbuser, $dbpass) or die("Unable to connect to $db");But I keep getting the following error:pHP Warning: mssql_connect() [function.mssql-connect]: message: Login failed for user '(null)'. Reason: Not associated with a trusted SQL Server connection. (severity 14).I have already set mixed mode authentication on the server, but it did not help.Please help
  2. MohammedU New Member

    Try to use "IP address of server, port number" if it is default instance it should be 1433
  3. dkusum_4 New Member

    Tried this one too, but gives same error
  4. Greg Larsen New Member

    I know little or nothing about php, but I am very familar with this error. This error normally has to do with when you are trying to connect using windows authentication and the remote user authentication is not being correctly passed to SQL Server. Normally happens when the remote user is not authenticated to IIS using Kerberos, so IIS is unable to pass on the remote user credentials to SQL Server. Since you seem to want to use SQL Server authentication, because you are passing a login and password, I would look at your IIS settings to verify that you are using SQL Server Authentication and not Windows Authentication. You might try to find out the setting of "mssql.secure_connection" option. I think if it is set to "on" then that means windows authentication.
  5. dkusum_4 New Member

    Hello Greg,
    I tried setting mssql.secure_connection = Off, which means I am using SQL Authentication. Please correct me if I am wrong.
    Then I used a username and password in mssql_connect, but gives the same error.
    I also tried to mssql.secure_connection = On, and use mssql_connect without any username and password. But the problem persists.
  6. Greg Larsen New Member

  7. Adriaan New Member

    Perhaps the database was moved to another server, without the appropriate steps to move the logins.
    Try exec sp_change_users_login 'auto_fix', login from QA - it will tell you on the Messages tab if an orphaned user was fixed.
  8. thomas New Member

    This a kerberos problem. Google 'kerberos SQL Server login failed' and it should turn something up.
  9. dkusum_4 New Member

  10. satya Moderator

    What is suppose to say?

Share This Page