(To be removed) Return names of ODBC and JDBC data sources
getdatasources function will be removed in a future release.
listDataSources function instead.
Retrieve Data Source Names
Connect to a database using its data source name.
Retrieve all ODBC and JDBC data source names on the system.
d = getdatasources
d = 1×11 cell array Columns 1 through 3 'Excel Files' 'MS Access Database' 'MS SQL Server' ...
d is a cell array of character vectors. Each character
vector is a data source name that is defined on the system.
Use the data source name in the
database function to connect
to a database at the command line. Or, in the Database Explorer app, click
New Query and then select the data source name
from the Data Source list.
d — Data sources
cell array of character vectors
Data sources, returned as a cell array of character vectors.
d is empty when the
ODBC.INI file is
valid, but no defined data sources exist.
For ODBC data sources, the
retrieves data source names from the
located in the folder returned by running:
myODBCdir = getenv('WINDIR')
The function also retrieves the names of data sources that are in the
system registry but not in the
For JDBC data sources, the
retrieves data source names that you define using the JDBC Data Source
Configuration dialog box in the Database Explorer app.
Introduced before R2006a