Main Content

Importing Data Common Errors

Address common errors that you can encounter when importing data from databases and customizing import options.

Data Import Common Errors

The following table describes errors that can occur in either the Database Explorer app or the command line when you use the fetch, sqlinnerjoin, and sqlouterjoin functions.

VendorError MessageProbable CausesResolution
AllMust provide either the "Keys" value, or both the "LeftKeys" and "RightKeys" values.You specified only the 'LeftKeys' or 'RightKeys' name-value pair argument.

Specify the 'Keys' name-value pair argument, or both the 'LeftKeys' and 'RightKeys' name-value pair arguments.

Multiple table entry found for tablename. Must provide LeftCatalog/RightCatalog and LeftSchema/RightSchema values.The database contains multiple tables with the same name across catalogs and schemas.

Specify the 'LeftCatalog' and 'LeftSchema' or 'RightCatalog' and 'RightSchema' name-value pair arguments.

Unable to find information for table tablename. Must provide either the "Keys" value, or both the "LeftKeys" and "RightKeys" values.The function cannot find information about the specified database table.

Specify the 'Keys' name-value pair argument, or both the 'LeftKeys' and 'RightKeys' name-value pair arguments.

Unable to find columns for table tablename. Must provide either the "Keys" value, or both the "LeftKeys" and "RightKeys" values.The function cannot find information about the columns of the specified database table.

Specify the 'Keys' name-value pair argument, or both the 'LeftKeys' and 'RightKeys' name-value pair arguments.

Unable to find common keys for table lefttable and righttable. Must provide either the "Keys" value, or both the "LeftKeys" and "RightKeys" values.The function cannot find common keys between the specified left and right tables to join.

Specify the 'Keys' name-value pair argument, or both the 'LeftKeys' and 'RightKeys' name-value pair arguments.

The number of key variables on the left and right must be the same.The number of specified keys for the left and right tables do not match.Specify the same number of keys for the 'LeftKeys' and 'RightKeys' name-value pair arguments.

Microsoft® SQL Server®

The statement did not return a result set.

There are other SQL statements in the middle of the stored procedure. This error happens after you execute exec but before you execute fetch. This error happens only with the command line.

Add 'SET NOCOUNT ON' at the beginning of your stored procedure. For details, see exec.

Microsoft SQL Server

JDBC Driver 3.0 returns incorrect date values when used with JRE™ 1.7 by a Java® application.

There is an issue with the Microsoft SQL Server JDBC Driver 3.0. This error happens after you execute fetch. This error happens either with Database Explorer or the command line.

Install a hotfix from Microsoft for JDBC Driver 3.0. Alternatively, upgrade your Microsoft SQL Server JDBC driver to version 4.0.

Microsoft SQL Server

Connection is busy with results for another command.

You are connecting to Microsoft SQL Server using a driver that preview does not support.

Connect to Microsoft SQL Server using the JDBC driver.

Oracle®

Stored procedures and functions return result sets as cursor types.

The JDBC driver returns stored procedure and function result sets as custom Java objects. This error happens after you execute fetch. This error happens only with the command line.

Write custom MATLAB® code to process the Java objects into MATLAB variables.

PostgreSQL

Java exception occurred: java.lang.OutOfMemoryError: Java heap space

The JDBC driver caches results in the memory. There is not enough memory in the Java heap to store the large amount of data fetched from your database. This error happens after you execute fetch. This error happens either with Database Explorer or the command line.

Write custom code. Write the code for connecting to your database via the command line. Then write the following.

conn.AutoCommit = 'off';

h = conn.Handle;

stmt = h.createStatement();

stmt.setFetchSize(50);

rs = stmt.executeQuery(java.lang.String('SELECT * FROM largeData where productnumber <= 3000000'));

Modify the previous statement to include your SQL query instead.

Then process the result set object rs in batches.

Custom Import Options Common Errors

The following table describes errors that can occur when you use the SQLImportOptions object to customize options for importing data from a database. These error messages apply across all database vendors.

Error MessageProbable CausesResolution
Calling function without an output argument has no effect. Use the following instead: opts = function(opts,...)

You did not specify an output argument when executing the setoptions function.

Use the setoptions function with an output argument.

argument must be a character vector or cell array of character vectors.

The specified input argument has an invalid data type.

The input argument must be a character vector or cell array of character vectors.

Unknown variable name: ''argument''.

The specified variable name is invalid.

Specify a variable name that exists in the VariableNames property of the SQLImportOptions object.

Variable selection out of range. Vector must contain integers between 1 and N, where N is the number of variables in the import options.

The specified index value is out of bounds within the number of selected variables.

Specify an index that is in the range of the number of variables in the SelectedVariableNames property of the SQLImportOptions object.

Expected a name or numeric index of a variable name.

The data type of the specified input argument is invalid.

The input argument must be a numeric index or a variable name.

Cell array of types must be a vector of length n.

The length of the specified data types is invalid.

When you set the VariableTypes property of the SQLImportOptions object, the length of the cell array must be equal to the number of variables.
Cell array of names must be a vector of length n.

The length of the specified variable names is invalid.

When you set the VariableNames property of the SQLImportOptions object, the length of the cell array must be equal to the number of variables.

See Also

| | | |

Related Topics