Setting Connection Timeout

One way to prevent idle connections from being cached is to set the ODBC connection timeout value to a very low number. By default, the ODBC timeout value is set to 60 seconds (or one minute), but you can change this value in one of two ways. If you want to set the value for every instance of the Microsoft Jet engine to another value, simply change the ConnectionTimeout setting in the \HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Jet\3.5\Engines\ODBC key in the Windows Registry to the new idle time (in seconds).

You can also set the value of the ConnectionTimeout setting by using the SetOption method in code. For more information, see “Using the SetOption Method to Control Registry Settings” in Chapter 13, “Optimizing Performance.”

Microsoft Jet closes the connection after the specified number of seconds of idle time unless a condition exists that prevents the connection from closing. This means that Microsoft Jet closes connections even if forms displaying remote data are still open. Microsoft Jet automatically reconnects when the application requires a connection again.

See Also For information on the conditions that can prevent connections from closing, see the following section, “Connections That Microsoft Jet Cannot Close.”

Note A ConnectionTimeout setting of 0 causes the connection to remain open indefinitely (no timeout).