User`s guide
Working with a Database and MATLAB
2-3
Working with a Database and MATLAB
This tutorial shows how to use Database Toolbox. You must make many decisions
to start using this toolbox. Use these steps and flowchart as a guide for choosing the
right options to get maximum benefit from using this toolbox and for understanding its
capabilities.
1
Install your database. For details, refer to your database administrator or your
database documentation.
2
Choose whether you want to use Database Explorer or the command line using the
following flowchart.
3
Choose whether you want to use an ODBC or JDBC driver. For details, see
“Choosing Between ODBC and JDBC Drivers” on page 2-10.
4
For ODBC drivers, the driver is typically preinstalled on your computer. For JDBC
drivers, you must install the driver. For details about ODBC and JDBC drivers, see
Driver Installation. If you have questions about which driver you need, refer to your
database administrator or your database documentation.
5
Define your data source for ODBC-compliant drivers or add the full path of the
driver to the static Java class path for JDBC-compliant drivers. For details, see
“Configuring a Driver and Data Source” on page 2-13.
6
Test the connection to your database using Database Explorer or the command line.
7
Connect to your database using Database Explorer or the command line. For details,
see “Connecting to a Database” on page 2-191.
8
Select data from your database and import the data into a MATLAB variable using
Database Explorer or the command line exec and fetch functions. For details, see
“Selecting Data” on page 2-195.
9
Insert data into your database by exporting data from a MATLAB variable using
datainsert, fastinsert, and insert functions. For details, see “Inserting Data
Using the Command Line” on page 2-197.
10
Generate a MATLAB script to automate your tasks using the Database Explorer
import functionality. For details, see “Generate MATLAB Code” on page 4-26.
11
For a graphical representation of the steps and the decisions you must make, see the
following flowchart.