Database Toolbox |
Syntax
Description
v = get(
returns a structure of the properties of object
)
object
and the corresponding property values, assigning the structure to v
.
v = get(
retrieves the value of object
, 'property'
)
property
for object
, assigning the value to v
.
returns the value of v.
property
property
, after you have created v
using get
.
Use set
(object)
to see a list of writable properties for object
.
database
exec
or fetch
driver
dmd
drivermanager
resultset
rsmd
If you are calling these objects from your own Java-based applications, see http://java.sun.com/j2se/1.4.2/docs/api/java/sql/DatabaseMetaData.html
for more information about the object properties.
Database Connection Object
Allowable property names and returned values for a database connection object are listed in the following table.
Property |
Value |
|
Status of the AutoCommit flag, either on or off , as specified by set |
'Catalog' |
Names of catalogs in the data source, for example, 'Nwind' |
|
Driver used for the JDBC connection, as specified by database |
|
Identifying JDBC connection object |
|
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 |
'ReadOnly' |
1 if the database is read only; 0 if the database is writable |
'TimeOut' |
Value for LoginTimeout |
'TransactionIsolation' |
Value of current transaction isolation mode |
'Type' |
Object type, specifically Database Object |
|
For a JDBC connection only, the JDBC URL object, jdbc:subprotocol:subname , as specified by database |
|
Username required to connect to the database, as specified by database ; note that you cannot use get to retrieve password |
'Warnings' |
Warnings returned by database |
Cursor Object
Allowable property names and returned values for a cursor object are listed in the following table.
Property |
Value |
|
Cursor attributes |
|
Data in the cursor object data element (the query results) |
'DatabaseObject' |
Information about the database object |
|
Maximum number of rows to be returned by fetch , as specified by set |
|
SQL statement for the cursor, as specified by exec |
|
Error message returned from exec or fetch |
'Type' |
Object type, specifically Database Cursor Object |
'ResultSet' |
Resultset object identifier |
'Cursor' |
Cursor object identifier |
'Statement' |
Statement object identifier |
'Fetch' |
0 for cursor created using exec ; fetchTheData for cursor created using fetch |
Driver Object
Allowable property names and examples of values for a driver object are listed in the following table.
Property |
Example of Value |
|
1 |
|
1001 |
Database Metadata Object
There are dozens of properties for a database metadata object. Some of the allowable property names and examples of their values are listed in the following table.
Drivermanager Object
Allowable property names and examples of values for a drivermanager object are listed in the following table.
Property |
Example of Value |
|
{'oracle.jdbc.driver.OracleDriver@1d8e09ef' [1x37 char]} |
|
0 |
|
[] |
Resultset Object
Some of the allowable property names for a resultset object and examples of their values are listed in the following table.
Property |
Example of Value |
|
{'SQL_CUR92535700x' 'SQL_CUR92535700x'} |
|
{1x2 cell} |
|
{[] []} |
Resultset Metadata Object
Allowable property names for a resultset metadata object and examples of values are listed in the following table.
The empty strings for CatalogName
and TableName
indicate that the database does not return these values.
For command line help on get
, use the overloaded methods.
help cursor/get help database/get help dmd/get help driver/get help drivermanager/get help resultset/get help rsmd/get
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 v
.
Example 2--Get Connection Property, AutoCommit Flag Status
Determine the status of the AutoCommit
flag for the database connection conn
.
Example 3--Display Data in Cursor
Display the data in the cursor object, curs
, by typing
In this example, curs
contains one column with four records.
Example 4--Get Database Metadata Object Properties
View the properties of the database metadata object for connection conn
. Type
MATLAB returns a list of properties, some of which are shown here.
v = AllProceduresAreCallable: 1 AllTablesAreSelectable: 1 DataDefinitionCausesTransaction: 1 DataDefinitionIgnoredInTransact: 0 DoesMaxRowSizeIncludeBlobs: 0 Catalogs: {4x1 cell} ... NullPlusNonNullIsNull: 0 NullsAreSortedAtEnd: 0 NullsAreSortedAtStart: 0 NullsAreSortedHigh: 0 NullsAreSortedLow: 1 UsesLocalFilePerTable: 0 UsesLocalFiles: 1
To view the names of the catalogs in the database, type
MATLAB returns the catalog names
ans = 'D:\matlab\toolbox\database\dbdemos\db1' 'D:\matlab\toolbox\database\dbdemos\origtutorial' 'D:\matlab\toolbox\database\dbdemos\tutorial' 'D:\matlab\toolbox\database\dbdemos\tutorial1'
See Also
columns
, database
, dmd
, driver
, drivermanager
, exec
, fetch
, resultset
, rows
, rsmd
, set
fetch | importedkeys |
© 1994-2005 The MathWorks, Inc.