Server Connection string

  • Hi all,

    Im writing this post to get some clarification on the issue I encountered while connecting to SQL server 2005 express edition from the Visual studio 2005.

    I used the following connection strings I received the Error 40 like most of them trying to connect to SQl using SQL Client

    "Initial Catalog=XXX;Data Source=Servername;Integrated Security=SSPI".

    "Initial Catalog=XXX;Data Source=Local;Integrated Security=SSPI"

    "Initial Catalog=XXX;Data Source=localhost;Integrated Security=SSPI"

    All these seems to be failing.

    I also checked my SQL Browser service and whether the SQL Express is registered . Tried connecting via OBDC the connection was successful.

    At last I tried by looking at some post and tried

    "Initial Catalog=GamePPD;Server=MyComputer\sqlexpress;Integrated Security=true;"

    then I was successful.

    I found in stack trace after execution of above command DataSource is assigned MyComputer\sqlexpress.

    This wake me up to find the solution why I was not successful when I assigned server name directly to Data Source parameter in connection string. Any help is appreciated

    Cheers,

    Vids

  • >> why I was not successful when I assigned server name directly to Data Source parameter in connection string

    In case of named instance, ServerName\InstanceName should be used. In case of default instance, "assigning server name directly to Data Source parameter in connection string" works.

  • [font="Verdana"]

    This wake me up to find the solution why I was not successful when I assigned server name directly to Data Source parameter in connection string.

    This means your server has more than one instances. To connect the specific instance, you need to mention it into your connection string.

    Mahesh[/font]

    MH-09-AM-8694

  • on an aside - if ever in doubt or struggling with connection strings visit

    http://www.connectionstrings.com

    although in this instance failing to include the instance name wouldn't be picked up by that site.

    MVDBA

  • Thank you guys for clarification.

    Cheers,

    Vids

Viewing 5 posts - 1 through 4 (of 4 total)

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