(Not recommended) Retrieve object properties
Retrieve the properties of a
Establish an ODBC database connection to a MySQL® database with the user name
username and password
conn = database('MySQL','username','pwd');
curs = exec(conn,'SELECT * FROM inventoryTable');
Retrieve the properties of
curs and assign them as fields in the
v = get(curs)
v = struct with fields: Data: 0 RowLimit: 0 SQLQuery: 'SELECT * FROM inventoryTable' Message:  Type: 'ODBCCursor Object' Statement: [1×1 database.internal.ODBCStatementHandle] Scrollable: 0 Position: 
Display the SQL query in the
ans = 'SELECT * FROM inventoryTable'
cursor object and database connection.
object— Database Toolbox™ object
Toolbox object, specified as a
property— Property of Database Toolbox object
Property of the Database Toolbox object, specified as a character vector or string scalar.
The following table shows available property names and returned values.
Data in the
Maximum number of rows returned by
SQL statement for a
Error message returned from
Object type, specifically
Handle to Java® statement object.
Logical value to identify the
Current position of the cursor in the data set. This property is available only for a scrollable cursor. This property behaves differently for native ODBC, JDBC, and other database drivers. This property is read-only.
s— Object properties
Object properties, returned as a structure that contains the object and its corresponding properties.
v— Object property value
Object property value, returned as a character vector, numeric scalar, cell array, or object.
getfunction is not recommended
Not recommended starting in R2018b
get function is not recommended. Use the
fetch function to import data. Some differences between the workflows might
require updates to your code.
There are no plans to remove the
get function at this time.
fetch function with the
object to import data from a database in one step.
In prior releases, you wrote multiple lines of code to create the
cursor object, retrieve object properties, and import data. For
curs = exec(conn,sqlquery); curs = fetch(curs); s = get(curs); results = curs.Data; close(curs)
Now you can import data in one step using the
results = fetch(conn,sqlquery);
There is no replacement functionality for the