Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

My Sql server is on Local Machine, I want to access it through Internet.

I Configure Surace manager and Configuration manager of sqlserver 2005 for remote access.

My sqlserver is running on port:1433

I am using port forwarding , I can access service of other ports,

My Connetion String Is: Data Source=,1433;Network Library=DBMSSOCN;Initial Catalog=myDataBase;User ID=myUsername;Password=myPassword;

But it gives following error when i am trying to connect sql server through internet:

A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: TCP Provider, error: 0 - A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.)

share|improve this question
Can you ping the IP Address – John Sansom Sep 9 '09 at 13:31
yes I can ping This ip address – Manish Sep 10 '09 at 5:33

I don't recommend you do this, given past experience (i.e. Slammer)

Is a VPN out of the question? Host-to-host OpenVPN perhaps?

share|improve this answer

It sounds like something is blocking the packets to your machine. Check the following:

  • Try running traceroute at a command prompt on your remote machine to make sure that packets can get to the local machine. (It sounds like they can from your description, but it doesn't hurt to check.)
  • Is the Windows firewall enabled? Or have you installed a third-party firewall?
  • Have you opened port 1433 in that firewall?
share|improve this answer

Try this:

  1. Make sure TCP/IP is enabled on your client's SQL Native Client configuration. Open SQL Server Configuration Manager, expand SQL Native Client Configuration, click Client Protocols, make sure TCP/IP is enabled
  2. Change your Connection String to this:

    Provider=SQLNCLI;Data Source=,1433;Network Library=DBMSSOCN;Initial Catalog=myDataBase;User ID=myUsername;Password=myPassword;

See if that works for you.

share|improve this answer


I have a problem with sql connection.

As I know, if I want to connect with MS SQL that is located on web then It(MS sql hosted server) requires remote connection mode enabled.

I have hosted my application provide by one of hosting service.

I have hosted my MS data base on

Here is the connection string for connection with my data base.

workstation;packet size=4096;user id=xxx;pwd=xxx;data;persist security info=False;initial catalog=erainsrbrl

using this connection string I can make connection from

My Database server and My application server is different. I can connect my database server from my application server although they are different hosting company and different pc.

If I can connect from my application server, then why I cannot connect from my desktop pc which is connected with internet.

If I want to connect from my pc then if shoes following error (although I have internet connection and real IP.)

My Question summery.

If i can connect from my web application(although web server and database server is different) then why i cannot connect from my desktop.

System.Data.SqlClient.SqlException: 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: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server) at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) at System.Data.SqlClient.TdsParser.Connect(Boolean& useFailoverPartner, Boolean& failoverDemandDone, String host, String failoverPartner, String protocol, SqlInternalConnectionTds connHandler, Int64 timerExpire, Boolean encrypt, Boolean trustServerCert, Boolean integratedSecurity, SqlConnection owningObject, Boolean aliasLookup) at System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(SqlConnection owningObject, SqlConnectionString connectionOptions, String newPassword, Boolean redirectedUserInstance) at System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, Object providerInfo, String newPassword, SqlConnection owningObject, Boolean redirectedUserInstance) at System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection) at System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnection owningConnection, DbConnectionPool pool, DbConnectionOptions options) at System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject) at System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject) at System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection owningObject) at System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection) at System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory) at System.Data.SqlClient.SqlConnection.Open() at _Default.Button2_Click(Object sender, EventArgs e)

share|improve this answer

Goto Sql Server Configuration Manager, And Network Properties then enable TCP/IP. Goto TCP/IP Properties Check the IP Address and Enabled is'True' or not.... Visit the article on this page:

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.