| Database Toolbox | ![]() |
Setting Up a Data Source
Before you can connect from the Database Toolbox to a database, you need to set up a data source. A data source consists of data that you want the toolbox to access, and information about how to find the data, such as driver, directory, server, or network names. You assign a name to each data source.
Getting and Preparing Databases for Examples
If you want to use the examples in this documentation, get the databases and prepare them.
dbtoolboxdemo Database
The dbtoolboxdemo data source uses the tutorial database provided with the Database Toolbox, $matlabroot\toolbox\database\dbdemos\tutorial.mdb. Before you can set up this data source, you must perform the following actions:
copyfile function, copy tutorial.mdb to a different directory, one for which you have write access, and rename it to tutorial_copy.mdb.
fileattrib function, ensure you have write access to the tutorial_copy.mdb.
tutorial_copy.mdb in Access. You might have to convert it to your version of Access. Save the converted version as tutorial.mdb.
SampleDB Database
The SampleDB data source uses the Microsoft Access sample database called Nwind.
Nwind.exe. Run the file to create the Nwind.mdb database.
Nwind_orig.mdb.
fileattrib function, ensure you have write access to Nwind_orig.mdb.
Nwind_orig.mdb in Access. You might have to convert it to your version of Access. Save the converted version as Nwind.mdb.
Nwind database in Microsoft Access.
Calc_Date and Avg_Cost.
Calc_Date field, use the default Data Type, which is Text, and
for the Avg_Cost field, set the Data Type to Number.
Avg_Freight_Cost and close it. Access warns you that
there is no primary key, but you do not need one. If you do designate a
primary key, you can run the example as written only once because
Access prevents you from inserting the same record twice.
| Structured Query Language (SQL) | Setting Up a Data Source for ODBC Drivers | ![]() |
© 1994-2005 The MathWorks, Inc.