Documentation

This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

get

(To be removed) Retrieve object properties

get will be removed in a future release. To retrieve connection object properties, access the connection object instead.

driver and drivermanager have been removed.

resultset and rsmd have been removed.

Syntax

s = get(object)
v = get(object,property)

Description

example

s = get(object) returns a structure s that contains the object and its corresponding properties.

example

v = get(object,property) returns the value v of property for the object.

Examples

collapse all

Retrieve the properties of a database metadata object created using a connection object.

Establish an ODBC database connection to a MySQL® database with user name username and password pwd.

conn = database('MySQL','username','pwd');

Construct a database metadata object using the connection object.

dbmeta = dmd(conn);

Retrieve the properties of dbmeta and assign them as fields in the structure v.

v = get(dbmeta)
v = 

  struct with fields:

                 AllProceduresAreCallable: 0
                   AllTablesAreSelectable: 0
    DataDefinitionCausesTransactionCommit: 1
      DataDefinitionIgnoredInTransactions: 0
               DoesMaxRowSizeIncludeBlobs: 0
  ...

Display catalog names in the database.

v.Catalogs
ans =

  2×1 cell array

    'information_schema'
    'toy_store'

Close the database connection.

close(conn)

Retrieve the 'AutoCommit' property of the connection object.

Establish an ODBC database connection to a MySQL database with user name username and password pwd.

conn = database('MySQL','username','pwd');

Check the status of the 'AutoCommit' property of the connection object.

v = get(conn,'AutoCommit')
v = 

  1×2 char array

    'on'

Close the database connection.

close(conn)

Input Arguments

collapse all

Database Toolbox™ object, specified as the following allowable objects:

  • connection object, which is created using database

  • cursor object, which is created using exec

  • Database metadata object, which is created using dmd

Property of the Database Toolbox object, specified as a character vector or string scalar.

For connection objects, see this table for the available property names and returned values.

connection Object PropertyDescription
'AutoCommit'

'on' or 'off', as specified by set. When 'AutoCommit' is set to 'on', the database automatically commits changes to the data. When 'AutoCommit' is set to 'off', the database requires an execution of the SQL COMMIT statement for committing changes to the data.

'Catalogs'

Name of catalogs in the data source. Extract a single catalog name from 'Catalog' for functions such as columns, which accept only a single catalog.

'Driver'

Driver used for a JDBC connection, as specified by database.

'DataSource'

Name of the data source for an ODBC connection or the name of a database for a JDBC connection, as specified by database.

'Message'

Error message returned by database.

'ReadOnly'

'on' if the database is read-only; 'off' if the database is writable.

'LoginTimeOut'

Number of seconds that the driver waits while trying to establish a database connection before throwing an error.

'Type'

Object type.

'URL'

For JDBC connections only, the JDBC URL object jdbc:subprotocol:subname, as specified by database.

'UserName'

User name required to connect to a given database, as specified by database.

You cannot use the get function to retrieve the Password property.

For cursor objects, see this table for the available property names and returned values.

cursor Object PropertyDescription
'Data'

Data in the cursor object data element (the query results).

'RowLimit'

Maximum number of rows returned by fetch, as specified by set.

'SQLQuery'

SQL statement for a cursor object, as specified by exec.

'Message'

Error message returned from exec or fetch.

'Type'

Object type, specifically 'Database Cursor Object'.

'Statement'

Handle to Java® statement object.

'Scrollable'

Logical value to identify the cursor object as scrollable or basic. This property is set to 1 for a scrollable cursor and 0 otherwise. This property is hidden and read-only.

'Position'

Current position of the cursor in the data set. This property is only available for a scrollable cursor. This property behaves differently for native ODBC, JDBC, and different database drivers. This property is read-only.

For database metadata objects, see this table for the available property names and returned values.

Database Metadata Object PropertyDescriptionExample of Value
'Catalogs'

List of database catalogs

{'toystore' 'dbo'}

'DatabaseProductName'

Database vendor name

'ACCESS'

'DatabaseProductVersion'

Database version number

'03.50.0000'

'DriverName'

Name of the JDBC or ODBC driver

'sqlncli11.dll'

'MaxColumnNameLength'

Maximum length of the database column name

64

'MaxColumnsInOrderBy'

Maximum number of database columns for sorting the data

10

'URL'

JDBC database URL for establishing a connection

'jdbc:odbc:dbdemo'

When CatalogName and TableName contain the value {'' ''}, databases do not return metadata for catalog and table names.

Data Types: char | string

Output Arguments

collapse all

Object properties, returned as a structure that contains the object and its corresponding properties.

Object property value, returned as a character vector, numeric value, cell array, or object.

Introduced before R2006a

Was this topic helpful?