| Database Toolbox | ![]() |
Set or get time allowed to establish database connection
Syntax
timeout = logintimeout('driver', time) timeout = logintimeout(time) timeout = logintimeout('driver') 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 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.
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
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
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
The time-out value is currently 0. Set the time-out to 10 seconds. Type
Verify the time-out value for the JDBC driver. Type
| isurl | namecolumn | ![]() |