User`s guide

exec
7-115
Connect to the MySQL database. This code assumes you are connecting to a data source
named MySQL with user name username and password pwd.
conn = database.ODBCConnection('MySQL','username','pwd');
Select all rows from the productTable table and create a scrollable cursor. Assign
the SQL statement to the variable sqlquery. Assign the returned cursor object to the
variable curs.
sqlquery = 'select * from productTable';
curs = exec(conn,sqlquery,'cursorType','scrollable')
curs =
ODBCCursor with properties:
Data: 0
RowLimit: 0
SQLQuery: 'select * from productTable'
Message: []
Type: 'ODBCCursor Object'
Statement: [1x1 database.internal.ODBCStatementHandle]
To verify that exec creates a scrollable cursor, display the hidden Scrollable property.
curs.Scrollable
ans =
1
The Scrollable property equals 1 when the cursor is scrollable.
After finishing with the cursor object, close it.
close(curs)
Select Data from a Database Table with a Timeout Value
Using the dbtoolboxdemo data source, select data from productTable that you access
using the database connection conn with a timeout of 10 seconds. The timeout value
specifies the maximum amount of time exec tries to execute the SQL statement. Assign
the SQL statement to the variable sqlquery. Assign the returned cursor object to the
variable curs.