CodeSmith Community
Your Code. Your Way. Faster!

Problem connecting to database with Integrated security=SSPI

Latest post 03-08-2007 11:00 AM by bgjohnso. 1 replies.
  • 03-08-2007 10:39 AM

    Problem connecting to database with Integrated security=SSPI

    I am having a problem connecting from a web server to a SQL 2005 database.  When my connection string includes 'Integrated security=SSPI;' , I recive the following error -

    Cannot open database "*******" requested by the login. The login failed.

    Login failed for user 'NT AUTHORITY\NETWORK SERVICE'.

    I am using .nettiers 2.0. 

    Here is my connection information -

    <configSections>
            <section name="*******.Data" type="*******.Data.Bases.NetTiersServiceSection, ********.Data" allowDefinition="MachineToApplication" restartOnExternalChanges="true"/>
            <section name="enterpriseLibrary.ConfigurationSource" type="Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ConfigurationSourceSection, Microsoft.Practices.EnterpriseLibrary.Common, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null"/>
        </configSections>
        <appSettings>
            <add key="****" value="user id=*****; password=*******; server=********; database=********;"/>
        </appSettings>

        <connectionStrings>
      <add name="********.Data.ConnectionString" connectionString="Data Source=*********;Initial Catalog=********;Integrated security=SSPI;user id=*********; password=*********;Connection Timeout=1;" />
      <add name="ConnectionString" connectionString="Data Source=********sql2005;Initial Catalog=********;Integrated security=SSPI;user id=********; password=*********"
       providerName="System.Data.SqlClient" />
        </connectionStrings>

     The same error is thrown if I use 'Integrated security=True;'.  If I take this out (which I don't think i want to do), the connection is made.

     
    I have a user with the appropriate permissions set up in SQL that I am trying to connect through.

    Please let me know what I am missing as I am new to .nettiers
     

    • Post Points: 35
  • 03-08-2007 11:00 AM In reply to

    • bgjohnso
    • Top 10 Contributor
    • Joined on 09-15-2005
    • Spokane, WA
    • Posts 764
    • Points 22,530

    RE: Problem connecting to database with Integrated security=SSPI

    You are mixing authentication types.  You either need to use SQL Server authentication (using the user id and password attributes) or use Integrated Security (using the Integrated Security attribute).  This isn't really a netTiers issue at all but rather just a SQL connection string issue.  If you want to truly use Integrated Security then you will need to add the account that the web service is running as to your SQL Server (in this case it's 'NT AUTHORITY\NETWORK SERVICE')

    Ben Johnson
    ------------------------------
     Member of the .NetTiers team
     Visit http://www.nettiers.com
    ------------------------------

    • Post Points: 5
Page 1 of 1 (2 items) | RSS
Copyright © 2008 CodeSmith Tools, LLC
Powered by Community Server (Commercial Edition), by Telligent Systems