none
Connecting timeout RRS feed

  • Question

  • I'm writing an application in C# that it connects to a SQL Server 2000 database called "Security". The SQL Server is running in a PC with XP SP2 named DEC-DEMIAN.

    I'm using the following connection string:

     

    string source = "Server = DEC-DEMIAN; Database = Security; User ID = Terminal2;" +

    "Password = 123; Trusted_Connection = False;";

     

    So, there's an user called Terminal2 in the database, and when I run the app. in the same PC where SQL Server is running, works fine. But trying to connect from another PC in the intranet using the same User ID, the app. throws an error, "Timeout" error says.

     

    So I can't be able to connect from another PC, and I set "remote connections" in SQL, but I can't. Maybe it's a stupid error, maybe I forgot some configuration, but I can't realize what is.

     

    I would really appreciate any help.

     

    Thankx.

     

    Demian.

    Monday, August 20, 2007 11:06 PM

All replies

  • If you are sure that name of the server is fine and you have proper network connection, then try to increase ConnectionTimeout property of SqlConnection. It might help. By-default it is 15 seconds and should be enough, but depends on network.

     

    Tuesday, August 21, 2007 1:30 AM
    Moderator
  • What is the name "provider" in the exception? Make sure it's not the "named pipes provider" which it sometimes is when you supply just the netbios name.

     

    As an alternative, use the IP address or a fully-qualified domain name for the machine and you should be good. If you must use the netbios name, you can also specify "Network Library=DBMSSOCN" in the connection string to force the TCP/IP provider. You could also try adding an alias for the machine.

    Tuesday, August 21, 2007 6:55 AM
  • But the ConnectionTimeOut property is readonly.

    Monday, August 27, 2007 3:52 PM
  • The name "provider" is "TCP error 0: ..."

     

    Using IP address I wrote a connection string like:

     

    Data Source=10.166.3.104,1433;Network Library=DBMSSOCN;Initial Catalog=Security;User ID=Terminal2;Password=123;

     

    And it throws :

     

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

     

    The message is longer, but after these lines follow some lines in spanish, (I'm in Argentina), that says about a timeout error because the host did not respond.

    Monday, August 27, 2007 4:15 PM