There are two places where you can specify Timeout settings in SQL. One being during the actual initialization of the connection string, called “ConnectionTimeout“. This will effect any query made under this database connection string. The other option would be to specify it during the actual query command, called “CommandTimeout“.
Where conn is an ADODB.Connection object that is not yet open, the connectionTimeout property will indicate the amount of time, in seconds, to wait for an ASP application to initially connect to the data source. The default is 15 seconds; to override the default, use syntax as follows:
<% Set conn = CreateObject("ADODB.Connection") conn.<strong>ConnectionTimeout</strong> = 120 conn.Open <connectionString> %>
CommandTimeout tells the server how long to wait, in seconds, for completion of any command sent to the data source. This value is editable before and after the connection has been opened. The default is 30 seconds, but you can override it like this:
<% Set conn = CreateObject("ADODB.Connection") conn.Open <connectionString> conn.<strong>CommandTimeout</strong> = 120 %>
Note that you can also apply a commandTimeout value to a command object, and it will behave independent of the commandTimeout value associated with the connection object. So for specific stored procedures or other commands being executed explicitly through the ADODB.Command object, you could have a longer timeout than that of the connection object. The syntax for the command object is almost identical:
<% Set cmd = CreateObject("ADODB.Command") cmd.<strong>CommandTimeout</strong> = 120 %>
Try our troubleshooting service
- Microsoft Certified Engineers
- Remote Log-in to Your Servers
- End-to-End Troubleshooting
Our Certified Technicians have been supporting Microsoft® products for well over a decade.
Tell us where you are getting stuck
Having Trouble Implementing This Solution?
Why not let our Microsoft® Certified Engineers do it for you.
Just $50.00 one time fee.