Database Toolbox User's Guide
  Go to function:
    Search    Help Desk 
logintimeout    Examples   See Also

Set or get time allowed to establish database connection

Syntax

timeout = logintimeout

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 database. 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 database. If MATLAB cannot connect within the allowed time, it stops trying.

timeout = logintimeout('driver') returns the time 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 successful immediately.

timeout = logintimeout returns the time 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 successful immediately.

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:

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:

The timeout value has not been set. Set the timeout to 10 seconds:

Verify the timeout value for the JDBC driver:

MATAB returns:

See Also

database

[ Previous | Help Desk | Next ]