Create a DatabaseDatastore to work with large amounts of data in relational databases. Write custom functions to implement mapreduce to process large amounts of data. To create a DatabaseDatastore, you must create a DatabaseDatastore object. This object is a type of datastore.
Create a DatabaseDatastore.
Determine if a DatabaseDatastore contains more data in the cursor object.
Display the first eight records in a DatabaseDatastore.
Read data in a DatabaseDatastore.
Read every record in a DatabaseDatastore.
Reset the cursor position in a DatabaseDatastore.
Fetch data sequentially or scroll up or down in the data without executing the query again. Scrolling within the data offers advantages when you are working with a large data set. An advantage of scrollable cursors is reading data in the middle of a large data set using the cursor position offset.
Support for native ODBC database connection for Windows® platforms. The native ODBC interface is available only for the command line. To use this interface, see Using the Native ODBC Database Connection. The native ODBC interface supports the following functions:
You can return a table data type rather than a cell array. Use the setdbprefs command to set the database preference for the DataReturnFormat property to 'table'.
dexplore starts Database Explorer, which is the Database Toolbox™ GUI for connecting to a database and importing data to the MATLAB® workspace. Alternatively, you can start Database Explorer by selecting Database Explorer from the Database Connectivity and Reporting section of the Apps tab in the MATLAB Toolstrip.
The new runsqlscript function lets you execute SQL commands from a .SQL file on a connected database, and store the results in a cursor array. You can input the results from executing runsqlscript to functions that accept cursor array inputs.
When using a JDBC driver, you can input individual connection properties to the database constructor, database.
The preferences you set using the Preference dialog box or the setdbprefs function now persist across MATLAB sessions.
In releases before R2011b, if you changed your preferences during a MATLAB session, these preferences would not remain in the next MATLAB session.
Many warning and error IDs have changed from their previous versions. These warnings or errors typically appear during a function call.
If using warning or error IDs, you might need to change the strings you use. For example, if you turned off a warning for a certain ID, the warning might now appear under a different ID. If you use a try/catch statement in your code, replace the old identifier with the new identifier. There is no definitive list of the differences, or of the IDs that changed.
New enhanced error messages provide more information about the error. For example, the 2009b error message Drivers not Found/Loaded is now Drivers not Found/Loaded. Please verify that login information and database url are valid in 2010b. This error will appear when the driver input is valid but the database URL is invalid.
The setdbprefs function now accepts a structure as input. For example, you can run the following commands to assign values to s:
s.DataReturnFormat = 'numeric'; s.ErrorHandling = 'report';
You can also do this for other setdbprefs properties whose values you want to change. Then set the preferences using the values in s by running the command:
For more information, see the setdbprefs reference page.
When you run a query in the Visual Query Builder and select File > Generate M-File, the resulting M-file now includes a placeholder string password in the database statement. If a password is required for the connection, such as for connections established via JDBC drivers, substitute the password for the password string. If no password is required, the M-file will run as is. For more information, see About Generated Files.
The generated M-file assigns values for the preferences to the structure s. For more information, see the setdbprefs reference page.
When you use getdatasources to view the data sources for your system, ensure that you view all data sources by specifying a temporary, writable, output directory using the new preference, TempDirForRegistryOutput. This is useful when you add data sources and do not have write access for the MATLAB current directory, where the toolbox temporarily writes ODBC registry settings. Without write access, getdatasources does not always return data sources you added. In that event, run setdbprefs to specify a value for the TempDirForRegistryOutput preference, where the value is the full path name to a directory for which you have write access.
The new function, database.fetch, executes the specified SQL query and imports results into the MATLAB workspace, given the connection handle conn. It is provided for convenience, to combine capabilities of the existing exec and cursor.fetch functions. In statements and code, do not specify database.fetch or cursor.fetch but rather, just specify fetch with the appropriate objects provided as arguments; the toolbox runs database.fetch or cursor.fetch as appropriate based on the arguments.
Unlike cursor.fetch, database.fetch does not return a cursor object on which you can run subsequent Database Toolbox functions, but rather returns all data to a MATLAB variable. For more information about database.fetch and how it differs from cursor.fetch, see the fetch reference page, as well as the database.fetch and cursor.fetch reference pages.
The new function, fetchmulti, imports data into the MATLAB workspace from multiple resultsets, which you retrieve via an exec call to a stored procedure that contains two or more select statements.
The new function, runstoredprocedure, executes a stored procedure using input parameters specified in a cell array to return output parameters. This allows you to retrieve the value of a variable into a MATLAB variable. runstoredprocedure overcomes a limitation of exec; when you run a stored procedures via exec, you can only retrieve resultsets.
You can now specify the catalog and schema for a data source using the Visual Query Builder. The default is none, meaning you do not need to select values for them.
The new setdbrprefs option, UseRegistryForSources, instructs the Visual Query Builder to search the Microsoft® Windows registry to find any ODBC data sources not uncovered using the system ODBC.INI.
In Version 7.3 (R2006b) of the MATLAB software, a change was made to how a nonscalar structure array field is assigned to a single MATLAB variable. For more information, see Assigning Nonscalar Structure Array Fields to a Single Variable in the MATLAB Release Notes.
As a result of this change in the MATLAB software, you may need to modify your Database Toolbox M-files.
There is a new function, fastinsert, that you can use instead of the insert function to export data about three times more quickly than insert. It also allows exporting for all object types, so that any data you can retrieve from a database you now can export to the database, including binary objects.
While there are no known problems with fastinsert, if you receive unexpected results, return to using insert and report the problem with fastinsert via Technical Support.
Note that the Visual Query Builder insert feature uses the insert function instead of fastinsert.
You now can use the Visual Query Builder (VQB) with JDBC drivers on Windows platforms. Previously, only ODBC drivers were supported.
The confds function now displays an enhanced dialog box you use to define JDBC data sources. With it, you save and load data source information via MATLAB MAT-files.
For details, see Setting Up JDBC Data Sources in the Database Toolbox documentation.
The Visual Query Builder now includes two new items under the Query menu:
Define ODBC Data Source—Directly access your Windows ODBC Data Source Administrator dialog box where you define ODBC data sources.
Define JDBC Data Source—Access the Define JDBC Data Source dialog box for defining JDBC data sources to use with the VQB. The function equivalent is confds. When you define a JDBC data source, the information is saved in a MAT-file so you can use it again in a later session. Later, open the MAT-file using the Define JDBC Data Source dialog box, or using setdbprefs('JDBCDataSourceFile','fullpathtomatfile').
For details, see Configuring Your Environment in the Database Toolbox documentation.
New arguments are supported for defining the JDBC data source MAT-file. For details, see the setdbprefs reference page.
You can dynamically add a JDBC drivers file to the MATLAB Java® classpath using the MATLAB javaaddpath function. You can use this method instead of adding a pointer to the JDBC drivers file in your classpath.txt file. The advantage of using javaaddpath is that you do not have to restart the MATLAB software session after running the javaaddpath statement. The disadvantage is that this only applies to the current session and so you need to run the javaaddpath statement in each new session. For details, see Setting Up JDBC Data Sources in the Database Toolbox documentation.
You now can retrieve 64-bit FLOAT data using Microsoft SQL Server® software.
After running a query using the Visual Query Builder, you can generate an M-file consisting of Database Toolbox functions that perform the query. This is useful if you know how to run queries with the VQB and want to determine the equivalent functions, particularly the SQL statements in exec and insert.
The update function has been enhanced so that you can export multiple records based on different where clauses. The number of where clauses must equal the number of records in the array of data you are exporting. For details, see the reference page for update.
|Release||Features or Changes with Compatibility Considerations|
|R2006b||MATLAB Change to Assignment of Nonscalar Structure Array Fields Might Impact Database Toolbox Users|