Database Toolbox    
logintimeout

Set or get time allowed to establish database connection

Syntax

Description

timeout = logintimeout('driver', time) sets the amount of time, in seconds, allowed for a MATLAB session to try to connect to a database via the specified JDBC driver. Use logintimeout before running the database function. If MATLAB cannot connect within the allowed time, it stops trying.

timeout = logintimeout(time) sets the amount of time, in seconds, allowed for a MATLAB session to try to connect to a database via an ODBC connection. Use logintimeout before running the database function. If MATLAB cannot connect within the allowed time, it stops trying.

timeout = logintimeout('driver') returns the time, in seconds, you set previously using logintimeout for the JDBC connection specified by driver. A returned value of zero means that the timeout value has not been set previously; MATLAB stops trying to make a connection if it is not immediately successful.

timeout = logintimeout returns the time, in seconds, you set previously using logintimeout for an ODBC connection. A returned value of zero means that the timeout value has not been set previously; MATLAB stops trying to make a connection if it is not immediately successful.

If you do not use logintimeout and MATLAB tries to connect without success, your MATLAB session could hang up.

Examples

Example 1 - Get Timeout Value for ODBC Connection

Your database connection is via an ODBC connection. To see the current timeout value, type

MATLAB returns

The timeout value has not been set.

Example 2 - Set Timeout Value for ODBC Connection

Set the timeout value to five seconds for an ODBC driver. Type

MATLAB returns

Example 3 - Get and Set Timeout Value for JDBC Connection

Your database connection is via the Oracle JDBC driver. First see what the current timeout value is. Type

MATLAB returns

The timeout value is currently 0. Set the timeout to 10 seconds. Type

MATLAB returns

Verify the timeout value for the JDBC driver. Type

MATAB returns:

See Also
database, get, set


 isurl namecolumn