LoginTimeout Property

   

Sets or returns the number of seconds before an error occurs when you attempt to log on to an ODBC database.

Syntax

VOIDSetLoginTimeout(SHORT sTime);

SHORTGetLoginTimeout(VOID);

Parameters

Type Argument Description
SHORT sTime A short integer containing the number of seconds before a logon timeout error occurs. The default is 20.

Remarks

When you're attempting to log on to an ODBC database, such as Microsoft SQL Server, the connection can fail as a result of network errors or because the server isn't running. Rather than waiting for the default 20 seconds to connect, you can specify how long to wait before raising an error. Logging on to the server happens implicitly as part of a number of different events, such as running a query on an external server database.

The default LoginTimeout property setting is 20 seconds. When the LoginTimeout property is set to 0, no timeout occurs.

You can use LoginTimeout on the CdbDBEngine object in both Microsoft Jet and ODBCDirect workspaces. You can use LoginTimeout on the CdbWorkspace object only in ODBCDirect workspaces. Setting the property to -1 on a CdbWorkspace will default to the current setting of DBEngine.LoginTimeout. You can change this property in a Workspace at any time, and the new setting will take effect with the next CdbConnection or CdbDatabase object opened.

The default value is determined by the ODBC driver. In a Microsoft Jet workspace, you can override the driver’s default value by creating a new “ODBC” key in the Registry path \HKEY_LOCAL_MACHINE\SOFTWARE\Jet\3.5\, creating a LoginTimeout parameter in this key and setting the value as desired.