login failed for user null

  • hi gurus

    i'm running the below osql command and i received the error login failed for user null.

    osql -E -Slocalhost

    security setting for sql server is already mixmode. i'm using a local account which is also a local server admin and is being used as the server account of sql server service.

    any advise on this. thanks

    art

  • Please try using the "Server Name" or the "IP Address" instead of "localhost".

    Pradeep Adiga
    Blog: sqldbadiaries.com
    Twitter: @pradeepadiga

  • same result:

    Login failed for user '(null)'. Reason: Not associated with a trusted SQL

    Server connection.

  • Which Edition of SQL Server are you using and what is the Operating system?

    Pradeep Adiga
    Blog: sqldbadiaries.com
    Twitter: @pradeepadiga

  • sql server standard edtion, windows server 2003 standard

  • Can't use -E from a command prompt... only from SQL Server. Where are you trying to run the OSQL command from?

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

  • Jeff Moden (2/26/2009)


    Can't use -E from a command prompt... only from SQL Server.

    I disagree with this. I have tried using -E (Trusted connection) and it works well from the command prompt.

    Art,

    Are you trying to connect to the "Default" instance or a named instance?

    Pradeep Adiga
    Blog: sqldbadiaries.com
    Twitter: @pradeepadiga

  • Art,

    Please check whether "BUILTIN\Administrators" have access to the SQL Server and also try adding the user again as below.

    Grant [domain\user]

    EXEC sp_grantlogin [domain\user]

    --Add that account to the sysadmins role:

    EXEC sp_addsrvrolemember @loginame = [domain\user]

    , @rolename = 'sysadmin'

    Also try whether you are able to connect to the server using "Query Analyzer" using Windows Authentication.

    Pradeep Adiga
    Blog: sqldbadiaries.com
    Twitter: @pradeepadiga

  • Whether your account is service account for SQL Server, it must be allowed to login to SQL Server by creating a windows login in SQL Server instance. Have your account also added in SQL Server?

  • Adiga (2/26/2009)


    Jeff Moden (2/26/2009)


    Can't use -E from a command prompt... only from SQL Server.

    I disagree with this. I have tried using -E (Trusted connection) and it works well from the command prompt.

    Art,

    Are you trying to connect to the "Default" instance or a named instance?

    Ah.... you're right... my bad. If Windows Authentication is enabled, it works fine.

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

  • i can now connect using localhost as the servername. But using hostname or IP address cannot.

  • Hi Art,

    You may want to check the Service Principal Name (SPN) for the service account. More information about SPNs is available here

    SetSPN utility can be downloaded from here

    Pradeep Adiga
    Blog: sqldbadiaries.com
    Twitter: @pradeepadiga

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

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