Why do I get Error 'Out of memory. Type HELP MEMORY for your options.' when querying a SQL Server table from MATLAB using Native ODBC interface?

5 Ansichten (letzte 30 Tage)
I am trying to connect to SQL database and fetch some data.
conn = database.ODBCConnection('MYDB_Test','','');
selectquery = 'SELECT * FROM "MYDB_Test"."dbo".Test';
e = exec(conn,selectquery)
curs = fetch(e)
In the Fetch statement, I get the Message as-
'Out of memory. Type HELP MEMORY for your options.'
This happens only with a specific table and the table is also not too big. It just has 5-6 rows and 4 columns.
The issue occurs while querying specific columns only, not other columns of the same table.
While trying to put some values in problematic columns, the following error was thrown-
"Driver unable to retrieve length for column number"
How to fix this?

Akzeptierte Antwort

MathWorks Support Team
MathWorks Support Team am 16 Jan. 2018
If you are using ODBC native interface and the following error is thrown  'fetch' statement-
'Out of memory. Type HELP MEMORY for your options.'
It happens because native ODBC interface doesn't support following data-types with SQL Server:
- ntext 
- text 
- varchar(max) 
- char(8000) 
- nchar(4000) 
- nvarchar(max) 
This is a limitation in Native-ODBC interface.
To workaround this issue, either switch to JDBC driver or change the data type of the columns to a supported data type.

Weitere Antworten (0)

Produkte


Version

R2016a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by