CDatabase::SetLoginTimeout

Call this member function — before you call OpenEx or Open — to override the default number of seconds allowed before an attempted data source connection times out.

void SetLoginTimeout( 
   DWORD dwSeconds  
);

Parameters

  • dwSeconds
    The number of seconds to allow before a connection attempt times out.

Remarks

A connection attempt might time out if, for example, the DBMS is not available. Call SetLoginTimeout after you construct the uninitialized CDatabase object but before you call OpenEx or Open.

The default value for login timeouts is 15 seconds. Not all data sources support the ability to specify a login timeout value. If the data source does not support timeout, you get trace output but not an exception. A value of 0 means "infinite."

Requirements

Header: afxdb.h

See Also

Reference

CDatabase Class

Hierarchy Chart

CDatabase::OnSetOptions

CDatabase::SetQueryTimeout