This tutorial provides steps for configuring data sources and connecting to other ODBC-compliant or JDBC-compliant databases that are not listed in Configuring Driver and Data Source. After creating a data source, you can connect to your database using the Database Explorer app or the command line.
These steps show how to configure a driver and connect to an ODBC-compliant database with MATLAB®. Database Toolbox™ can connect to any ODBC-compliant database that is relational and uses ANSI® SQL. For example, if your database is Microsoft® Excel® or IBM DB2®, follow these basic steps:
If your driver is not preinstalled on your computer, find a compatible driver and install it on your computer. You can view preinstalled drivers using the Microsoft ODBC Data Source Administrator dialog box. For details about this dialog box, see Driver Installation.
Create a data source by using the installed driver and the Microsoft ODBC Data Source Administrator dialog box.
Use the Database Explorer app to test your connection and connect to your database. For an example, see MySQL ODBC for Windows.
Or, you can connect to your database using the
database function at
the command line.
For detailed assistance, contact your database administrator or refer to your database documentation.
These steps show how to configure a driver and connect to a JDBC-compliant database with MATLAB. Database Toolbox can connect to any JDBC-compliant database that is relational and uses ANSI SQL. For example, if your database is Apache™ Derby or Microsoft Windows® Azure®, follow these basic steps:
The details of these steps can vary depending on your database and database version. For detailed assistance, contact your database administrator or refer to your database documentation.
If your driver is not preinstalled on your computer, find a compatible driver and install it on your computer.
Create a data source by using the JDBC Data Source Configuration
dialog box. For details about this dialog box, see the
In the Name box, enter a name for your data source. You use this name to establish a connection to your database.
From the Vendor list, select
In the Driver Location box, specify the full path of the driver file.
To connect to a JDBC-compliant database, you must know your
database driver Java® class object. For example, the Java class object for an SQLite database driver is
org.sqlite.JDBC. In the
Driver box, specify this driver
For JDBC-compliant databases, specify the driver and URL in the JDBC Data Source Configuration dialog box. The driver and the URL string can vary depending on the type and version of the JDBC driver and the database you are working with. For details about the driver and URL, see the JDBC driver documentation for your database.
To connect to a JDBC-compliant database, you must create a URL
string. The URL string is in the form
jdbc part of this string stays constant for
any JDBC driver.
subprotocol is the database
type. The last part of the URL string is
subname contains the location of the database
and additional connection information, such as the port number. For
example, if you are using SQLite, the string is
dbpath is the full path to your SQLite
database on your computer. In the URL box,
specify this URL string.
Click Test to test your connection. If the connection is successful, then click Save to save the JDBC data source.