Click here to Skip to main content
15,798,825 members
Please Sign up or sign in to vote.
2.00/5 (2 votes)
See more: , +
Hi all ,I dont have so much experience in SQL server. I'm trying to connect to an SQL Server 2005 via IP address.My connection string is

"Data Source=,1433;Network Library=DBMSSOCN;Initial Catalog=PostDB;User ID=;Password=")

I'm getting this error.

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: TCP Provider, error: 0 - No connection could be made because the target machine actively refused it.)

I have enabled TCP/IP connection using Surface Configuration tool and I dont have a firewall now.

So how can I solve this? And please give me some advice and insights about storing and retrieving data in remote SQL server. I have no other way to clarify this issue.
Thank you in advance.
ahsanriaz1K 15-May-12 3:15am    
Are you using Management studio for MS SQL server at server side?
Member 8567943 15-May-12 3:16am    
Yes I am

This error means, the server you are trying to connect is found, but for some reason denying the client access. Client is trying to connect through an invalid port or it does not allow remote connections or a firewall issue.

Look here for full detailed explanation here:
Error message: TCP Provider.. - Cause & Resolution[^]
MSDN Blog: (provider: TCP Provider, error: 0 - No connection..[^]

If needed, troubleshoot more following this: MSDN Blog: TCP Provider: No connection could be made because..[^]
Share this answer
Member 8567943 15-May-12 5:40am    
Can I ask a doubt? If I enter my current machine's IP address on the Data Source section, is it similar to entering 'localhost'?
Sandeep Mewara 15-May-12 11:53am    
Yes, it should be same thing.
Member 8567943 16-May-12 8:59am    
But when I enter localhost it works, when I enter ip it doesnt.
Sandeep Mewara 16-May-12 12:30pm    
It depends. I guess, you need a static IP for it. Generally, we have dynamic IP's.
Member 8567943 16-May-12 13:05pm    
So you are saying it only works on static ips?

pls chk ur sql configuration manager . see, whether tcp/ip is enabled, what port is used. kindly restart ur sql after checking all these details.
Share this answer
see to
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900