| Database Toolbox User's Guide | Search  Help Desk |
| get | Examples See Also |
Get property of database connection or cursor structure
Syntax
value = get(conn, 'propertyname') value = get(cursor, 'propertyname') value = conn.propertyname value = cursor.propertyname
Description
value = get(conn, 'propertyname')
gets the value of propertyname for the database connection, conn.
Allowable property names and returned values for conn are |
status of the autocommit flag, either on or off, as specified by set |
|
driver used for the JDBC connection, as specified by database |
|
identifying number for the connection |
|
name of the data source for an ODBC connection or the database for a JDBC connection, as specified by database |
|
error message returned by database |
|
for a JDBC connection only, the JDBC URL structure, jdbc:subprotocol:subname, as specified by database |
|
user name required to connect to the database, as specified by database; note that you cannot use get to retrieve password |
value = get(cursor, 'propertyname')
gets the value of propertyname for the cursor structure, cursor.
Allowable property names and values for cursor are: |
cursor attributes |
|
data in the cursor structure data element |
|
error message returned from exec or fetch |
|
maximum number of rows to be returned by fetch, as specified by set |
|
SQL statement for the cursor, as specified by exec |
value = conn.propertyname
gets the value for the specified connection propertyname.
value = cursor.propertyname
gets the value for the specified cursor propertyname.
For command line help on get, use the overloaded methods:
help cursor/get.m help database/get.m
Examples
Example 1 - Get connection property, data source name
Connect to the database,SampleDB. Then get the name of the data source for the connection and assign it to AA:
connA = database('SampleDB', '', '');
AA = get(connA, 'instance')
MATLAB returns:
AA = SampleDB
Example 2 - Get a connection property, autocommit flag status
Determine the status of theautocommit flag for connA:
get(connA, 'autocommit') ans = on
Example 3 - Display data in cursor
Display the data incursorA:
get(cursorA, 'data')or type:
cursorA.dataMATLAB returns:
ans =
'Germany'
'Mexico'
'France'
'Canada'
cursorA contains one column with four records.
See Also
attr, cols, columnnames, database, fetch, rows, width, set