none
MS Sql 2005 Connection issue

    Question

  • Dear All,

    I am facing an issue while connecting to MsSql2005 through my Application. The server is installed on my local machine itself. If I am using the name of my machine in the connection string like - Data Source=hostname\sqlexpress;Initial Catalog=test;Max Pool Size=500;Integrated Security=True;as

    then in that case it is working fine. but if I am using ipaddress in place hostname in the connection string then in that case it is throwing the following error

    '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 - No connection could be made because the target machine actively refused it.)'

     

    I have checked the ip address of my machine and it is the same which I am providing in the connection string. I have checked the SQL Server Configuration Manager  and TCP/IP is enabled there for the IP address of the machine. I have allowed the remote connections for the DB server also.

    Please suggest me some more trouble shooting steps which can be done from my side

    Please help.


    Friday, September 24, 2010 8:56 AM

Answers

  • You need to enable remote access to your instance in order to use the machine IP address in the data source. Without remote access you can use machine name, "localhost" or ".". Either specify the TCP port your instance is listening on in the connection string or start the SQL Browser service. You can find detailed instructions here: http://blogs.msdn.com/b/sqlexpress/archive/2005/05/05/415084.aspx (just ignore the note in red).

    Hope it helps

    • Marked as answer by vikie Friday, September 24, 2010 11:14 AM
    Friday, September 24, 2010 10:45 AM

All replies

  • Hi Vikie,

    Just want to check one thing are you connecting using "IPADDRESS\SQLEXPRESS" or just "IPADDRESS".

     


    Regards Gursethi Blog: http://ms-gursethi.blogspot.com/ Please mark "Propose As Answer" if my answer helped..... :)
    Friday, September 24, 2010 10:27 AM
  • Yes I am using "IPADDRESS\SQLEXPRESS"
    Friday, September 24, 2010 10:38 AM
  • You need to enable remote access to your instance in order to use the machine IP address in the data source. Without remote access you can use machine name, "localhost" or ".". Either specify the TCP port your instance is listening on in the connection string or start the SQL Browser service. You can find detailed instructions here: http://blogs.msdn.com/b/sqlexpress/archive/2005/05/05/415084.aspx (just ignore the note in red).

    Hope it helps

    • Marked as answer by vikie Friday, September 24, 2010 11:14 AM
    Friday, September 24, 2010 10:45 AM
  • Thanks a ton Radu. It worked :)
    Friday, September 24, 2010 11:14 AM