Connection timeout controls how long a client waits to establish a SQL Server session before aborting.
Shortening or extending the timeout prevents apps from hanging during network hiccups or busy servers. Setting the value explicitly makes connection behavior predictable and easier to debug.
Most drivers, including ADO.NET and ODBC, default to 15 seconds. If the login handshake does not finish by then, an error is raised.
Add the keyword Connect Timeout=##
(or Connection Timeout
) where ##
is the number of seconds. Zero means wait indefinitely, which is discouraged.
Server=tcp:prod-sql,1433;Database=ShopDB;User Id=app;Password=***;Connect Timeout=30;
sqlcmd -S prod-sql -d ShopDB -U app -P "***" -l 45
Client timeout is external, but you can raise the server-side ceiling for remote queries so that distributed commands have more time to return.
sp_configure
EXEC sp_configure 'remote query timeout', 120; -- secondsRECONFIGURE;
Throttle the network or pause the SQL Server service, initiate a connection, and confirm that the client errors out after the configured interval.
Start at 30 seconds for web apps, 60–90 seconds for heavy ETL jobs. Monitor baseline connection times; set the limit slightly above the 95th percentile.
Leaving the value at zero causes hidden hangs. Setting it too low breaks initial logins on slow VPNs. Adjust, test, and document the chosen value.
No. It only governs the login phase. Use COMMAND TIMEOUT
(e.g., SqlCommand.CommandTimeout
) for statements after the session is open.
No. Connect Timeout
and Connection Timeout
are aliases and not case-sensitive.
Yes. In SSMS, Tools ➜ Options ➜ Query Execution ➜ SQL Server ➜ Execution time-out lets you control it for each window.