none
provider: TCP Provider, error: 0 - No connection could be made (Need help)

    Question

  •  

    I try to connect to a SQL Server 2005 Express Edition via IP address. But anytime the application tries to connect to the database here is th error message I receive:

     

     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.)             

     

                 There is the connection String code:

     

                         "Data Source=192.168.1.109,1433;Network Library=DBMSSOCN;" & _

                         "Initial Catalog=myDataBase;" & _

                         "UserID=Username; Password=Password;"

     

    Already checked

     

         I have enabled the TCP/IP under SQL Server, 

         Under SQL Server Configuration Area, I have chosen the option Local and remote connection: TCP/IP only 

         I have verified that my firewall allows SQL remote and a Local Connection.

     

     

    Now I don't know where to look or what I have to fix to continue. I will really appreciate if somebody can help me.

     

    Thank you in advance.

     

    AA 

       

    Wednesday, May 14, 2008 12:30 AM

Answers

  • "No connection could be made because the target machine actively refused it"

    This means that your SQL Server is not listening on the port your specified in the connection string, which is 1433. Can you check the errorlog file and find out the actual TCP port you are listening. Btw, this is SQL Express. In most cases, it should not listen on 1433. You can also remove 1433 form the connection string and let SQL Browser to discover the TCP port for you (you need enable Browser in this case.) Please let us know if you still have issue and refer to

    http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=3269474&SiteID=1

     

    Thanks.

    Wednesday, May 14, 2008 4:53 PM
    Moderator
  • You have "Initial Catalog=myDataBase"

    Do you really have this database on server? You need grant your login (user) permission to the database in order to logon. Please also check the errorlog, you may get more info about why it fails.

    http://blogs.msdn.com/sql_protocols/archive/2006/02/21/536201.aspx

    Thanks.

    Thursday, May 15, 2008 11:12 PM
    Moderator
  • Thank you Xinwei Hong ...

     

    I have finally found my mistake. On the client machine I didn't enable the VIA protocol used by the client computer to communicate with the server. I have enabled it now everything work perfectly.   

     

     

    Thank you for your advices.  

     

    Ailiam Attobra

     

     

     

    Wednesday, May 21, 2008 6:27 PM

All replies

  • "No connection could be made because the target machine actively refused it"

    This means that your SQL Server is not listening on the port your specified in the connection string, which is 1433. Can you check the errorlog file and find out the actual TCP port you are listening. Btw, this is SQL Express. In most cases, it should not listen on 1433. You can also remove 1433 form the connection string and let SQL Browser to discover the TCP port for you (you need enable Browser in this case.) Please let us know if you still have issue and refer to

    http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=3269474&SiteID=1

     

    Thanks.

    Wednesday, May 14, 2008 4:53 PM
    Moderator
  •  

    Thank you Xinwei Hong for you advice. I found the correct port and it seems to listen to it. But I have another problem; this time is about the user ID and the password; 

     

    What I have done:

     

            I have created a new user and password using  and granted him full access to the database but anytime I tried to access the database, the system tells me that :

     

    Login failed for user X. The login is not associated with a trusted SQL Server Connection.  

     

    What should I do now ?

     

     

    Thank you .

     

     

     

    Thursday, May 15, 2008 4:30 PM
  • You have "Initial Catalog=myDataBase"

    Do you really have this database on server? You need grant your login (user) permission to the database in order to logon. Please also check the errorlog, you may get more info about why it fails.

    http://blogs.msdn.com/sql_protocols/archive/2006/02/21/536201.aspx

    Thanks.

    Thursday, May 15, 2008 11:12 PM
    Moderator
  • The database exists and I did grant to the user full permission to the database.

    I have read some articules regarding this problem and writers suggested to create a DOMAIN\USER. Have you hear about that as a solution ? 

     

    There is the message I have got from errorlog:

     

    2008-05-15 10:55:54.04 Logon       Error: 18452, Severity: 14, State: 1.

    Login failed for user 'Ailiam'. The user is not associated with a trusted SQL Server connection. [CLIENT: 192.168.1.103]


     

    Thank you for your help.

    Friday, May 16, 2008 1:23 AM
  • Your DOMAIN\USER is a windows logon, and you should not create a windows logon for this case.

    Are you able to use OSQL/SQLCMD to connect with the following cmd?

    sqlcmd -Stcp:.\sqlexpress -UAiliam -dMyDatabase

     

    If not, what's the error msg?

     

    Also, I suggest to follow this link to troubleshoot.

    http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=3269474&SiteID=1

    Friday, May 16, 2008 6:00 PM
    Moderator
  • Thank you for you help. I finally got access to my database with my username and my password without problem.

     

    I have another story. 

     

    This time I want to create a Local Area Network where my primary database will be installed on one machine(1) and the application on another machine(2).

     

       - The client (2) will get information from the SQL Server located at (1).

      

    WHAT I HAVE   

           I have the IP address of (1) and also the port that SQL Server listens to.   

           I am using windows XP SP2 on both machines(1) and (2)

     

     

    QUESTION

    How can I create this scenario with the information given? 

     

     

    Thank you in advance    !

     

    Ailiam A.

     

    Saturday, May 17, 2008 3:17 PM
  • Thank you for you response SQLUSA. Don't get me wrong I did not say that I have a problem with the connection String

     

    As matter of fact, I can connect to my database using the same machine without any problems. My question is how do I access my database using a different computer which is on the same network that my computer ? (SEE DESIGN)

     

     

    DESIGN  

     

         Computer 1     ------------------------------------------------------------------------------------------------------------->  Computer 2       

          

             -  SQL Server 2005 database                                                                                      - My program          
             -  OS: Windows XP SP2                                                                                            - OS: Windows XP SP2 

     

     

     

    Thank you in advance

     

     

    Ailiam A.

    Monday, May 19, 2008 1:20 AM
  • Don't understand your problem, You can use the IP with port number from computer 2 to access Computer 1. Do you see any error? Thanks.

    Monday, May 19, 2008 8:31 PM
    Moderator
  • Thank you Xinwei Hong ...

     

    I have finally found my mistake. On the client machine I didn't enable the VIA protocol used by the client computer to communicate with the server. I have enabled it now everything work perfectly.   

     

     

    Thank you for your advices.  

     

    Ailiam Attobra

     

     

     

    Wednesday, May 21, 2008 6:27 PM