How to connect to a local SQL Server?

how to configure SQL Server 2005 for remote connection? I have to access a local SQL Server with a web application.

Thank you!


When you installed SQL did you use the 'default' instance, or a 'named' instance? If you're not sure, take a look in your Services control panel (under Administrative Tools).

If the services for SQL have (MSSQLSERVER) after them, then you are on the 'default' instance. If they have anything else after them (e.g. (SQL2005)) then you are on a 'named' instance.

Connecting to the default instance is simple - just connect to the server name. If you are on a named instance, you need to connect to the server name, backslash () instance name.

Eg if your named instance is "SQL2005" then you would connect to SERVER\SQL2005.

With that in mind, what is the exact error message you are receiving?


This is done using the SQL Server Configuration Manager. There is a detailed how to available for all aspects of this process here.

  • Start / Programs / SQL Server 2005 / Configuration Tools / SQL Server Configuration Manager
  • SQL Server Network Configuration
  • Protocols for [ServerName]
  • Double click on TCP/IP and change it to Enabled
  • Restart the SQL Service under SQL Server Services.

Also check that your Firewall is allowing access to SQL Server. This Microsoft support article covers the exceptions needed for SQL Server on the Firewall.

Edit

Based on your error it seems like you might be using an incorrect connection string?

To connect to your machine from another site you should use either the Machine IP address or machine name, eg: [MACHINENAME][INSTANCENAME] or [MACHINEIP][INSTANCENAME]. Also if your in a corporate environment it may be a problem if you are behind a firewall or proxy since your machine is not directly accessible from the outside, and the webserver might only be visible from the inside of the network. If your running everything on your machine ensure that you can see the machine from outside of the network.