User`s guide
Working with a DatabaseDatastore
6-79
Working with a DatabaseDatastore
In this section...
“About DatabaseDatastore Objects” on page 6-79
“Advantages of DatabaseDatastore Objects Over Basic Fetching” on page 6-79
About DatabaseDatastore Objects
A DatabaseDatastore object is a type of datastore in MATLAB. DatabaseDatastore
objects let you import data into MATLAB from relational databases.
You can connect to your database using native ODBC or JDBC interfaces and create
a DatabaseDatastore object. This object creates a data set from the SQL query you
specify in datastore. Using a DatabaseDatastore object, you can perform these
tasks:
• Preview data.
• Read data in chunks.
• Read every record in the data set.
• Reset the cursor position to the start of the data set.
• Continue reading data until the cursor position reaches the end of the data set.
• Analyze a large data set stored in a database using MapReduce.
Tip: Running MapReduce using a DatabaseDatastore object with Parallel Computing
Toolbox™ installed does not support using a parallel pool. For details about controlling
parallel resources, see “Run mapreduce on a Parallel Pool”.
Advantages of DatabaseDatastore Objects Over Basic Fetching
Reading data from DatabaseDatastore objects is the same as executing exec and
fetch on the data set. Here are the advantages of using DatabaseDatastore objects:
• Work with databases containing large amounts of data.
• Write custom functions to implement MapReduce to analyze large amounts of data
using mapreduce. For an example, see “Analyze Large Data Sets in a Database with