locked
Changing SQL Connection Settings RRS feed

  • Question

  • User-2141053768 posted

    The starter kit looks great but i want to change it to use full blown sql 2005.

    I have changed the web config file,and also allowed remote connections but i am still not getting a connection

    An error has occurred while establishing a connection to the server.  When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)

     

    Any Ideas ?

    Thursday, April 10, 2008 6:35 AM

All replies

  • User312496708 posted

    Try Connecting to the sql server from any other applictaion and see if you can connect to the database. If the connection works use the same in this application

    Thursday, April 10, 2008 7:21 AM
  • User2078207646 posted

    if working locally your connection string in your web.config should look like this 

    <
    connectionStrings><add name="classifiedsConnection" connectionString="Data Source=yourmachinename\SQLEXPRESS;Initial Catalog=classifiedsdb;Integrated Security=True;" providerName="System.Data.SqlClient"/>

     

    </connectionStrings>

    if you still have a user instance in the string try removing first

    else try

    If you are getting the error when working locally - go to sql configuration manager > network config > protocols sqlexpress and disable everything except shared memory for now and see if this works

    If you are working remotely your connection string should look like this

    <connectionStrings>

    <remove name="LocalSqlServer" />

    <add name="LocalSqlServer" connectionString="Data Source=xxx;Initial Catalog=xxx;UID=xxx;pwd=xxx"

    providerName="System.Data.SqlClient" />

    <add name="classifiedsConnection" connectionString="Data Source=xxx;Initial Catalog=xxx;UID=xxx;pwd=xxx"

    providerName="System.Data.SqlClient" />

     

    </connectionStrings>

    Thursday, April 10, 2008 8:40 AM
  • User1128022426 posted

    Missing the user instance is a very common mistake in connection strings...

    Another trick to test connectivity to a sql server is to 

    1. Create a text file on your computer with a .udl extension...

    2. double click that file and you should get a wizard that can guide you in the connection...

    after sucessfully enstablishing the connection and save it, you can open the udl file in a text editor and view the created connection string.... If nothing you will be able to get the necessary information to enter it in your web.config.

    Thursday, April 10, 2008 9:57 AM