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.

catalogs

(To be removed) Get database catalog names

catalogs will be removed in a future release. Use the DefaultCatalog and Catalogs properties of the connection object instead.

Syntax

cn = catalogs(conn)

Description

example

cn = catalogs(conn) returns the catalogs for the database connection conn.

Examples

collapse all

Create a database connection conn to the MySQL® database using the JDBC driver. Use the Vendor name-value pair argument of database to specify a connection to a MySQL database. Here, this code assumes that you are connecting to a database named dbname on a database server named sname with user name username and password pwd.

conn = database('dbname','username','pwd',...
                'Vendor','MySQL',...
                'Server','sname');

Alternatively, use the native ODBC interface for an ODBC connection. For details, see database.

Retrieve the catalog names using conn.

cn = catalogs(conn)
cn = 

    'toy_store'
    'mysql'
    'db'
    ...

cat returns a cell array of catalog names in the MySQL database.

Close the connection.

close(conn)

Input Arguments

collapse all

Database connection, specified as a connection object created using the database function.

Output Arguments

collapse all

Catalog names, returned as a cell array containing the names of the catalogs in the database. The contents of cn that you see depend upon your permission settings in the database.

Introduced in R2010a

Was this topic helpful?