I will then try again three times before giving up and either raising a support ticket or escalating a similar existing support ticket. This setting should depend on the speed of your network and how long you are prepared to allow a thread to wait for a response.Īs an example, on a task that repeats hourly during the day, I know my network has always responded within one second so I set the connection timeout to a value of 2 just to be safe. What should I set my Connection Timeout value to? Will you seriously be prepared to wait even a day for a response that may never come? Note: A value of 0 is not advised since it is possible for either the connection request packets or the server response packets to get lost. CreateObject(ADODB.Connection) .4.0 conn.ConnectionTimeout30 conn.open server.mappath(database. a value of 10 means to wait 10 seconds.Ī value of 0 means to never give up waiting for the connection
If there is no value specified for connection timeout in the connection string then the default value is 30.Ī value greater than zero means how many seconds before it gives up e.g. When the timeout expires then the thread will continue, but it will do so having reported a connection failure. The connection timeout is measured in seconds from the point the connection is opened. This thread will then pause until either network packets about this connection are received from the database server or when the connection timeout expires. What this means is that when a connection is opened then the thread establishing the connection will send network packets to the database server. It specifies how long you will allow your program to be held up while the command is run.Ī connection between a program and a database server relies on a handshake. In addition, SqlCommand.CommandTimeout specifies the timeout value of a specific query running on SQL Server, however this is set via the SqlConnection object/setting (depending on your programming language), and not in the connection string i.e. The value is expressed in seconds, not milliseconds.Ī value of 0 means to wait indefinitely and never time out. This is always set as part of the connection string. You can set the amount of time a connection waits to time out by using the Connect Timeout or Connection Timeout keywords in the connection string.
specifies how many seconds the SQL Server service has to respond to a connection attempt. It specifies how long you will allow your program to be held up while it establishes a database connection. Connection Timeout=30 means that the database server has 30 seconds to establish a connection.Ĭonnection Timeout specifies the time limit (in seconds), within which the connection to the specified server must be made, otherwise an exception is thrown i.e.