Return names of ODBC and JDBC data sources on system
d = getdatasources
d = getdatasources returns the names of valid ODBC and JDBC data sources on the system as a cell array d of strings. The function gets the names of ODBC data sources from the ODBC.INI file located in the folder returned by running:
myODBCdir = getenv('WINDIR')
d is empty when the ODBC.INI file is valid, but no data sources are defined. d equals -1 when the ODBC.INI file cannot be opened.
The function also retrieves the names of data sources that are in the system registry but not in the ODBC.INI file.
If you do not have write access to myODBCdir, the results of getdatasources may not include data sources that you recently added. In this case, specify a temporary, writable, output folder via the preference TempDirForRegistryOutput. For more information about this preference, see setdbprefs.
getdatasources gets the names of JDBC data sources from the file that you define using setdbprefs or the Define JDBC data sources dialog box.
Get the names of databases on your system.
d = getdatasources d = 'MS Access Database' 'dbtoolboxdemo'