Database Toolbox Previous page   Next Page
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 time-out 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 time-out 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 Time-Out Value for ODBC Connection

Your database connection is via an ODBC connection. To see the current time-out value, type

MATLAB returns

The time-out value has not been set.

Example 2--Set Time-Out Value for ODBC Connection

Set the time-out value to 5 seconds for an ODBC driver. Type

MATLAB returns

Example 3--Get and Set Time-Out Value for JDBC Connection

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

MATLAB returns

The time-out value is currently 0. Set the time-out to 10 seconds. Type

MATLAB returns

Verify the time-out value for the JDBC driver. Type

MATAB returns

See Also
database, get, set


Previous page  isurl namecolumn Next page

© 1994-2005 The MathWorks, Inc.