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?

6 ビュー (過去 30 日間)
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?

採用された回答

MathWorks Support Team
MathWorks Support Team 2018 年 1 月 16 日
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.

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeDatabase Toolbox についてさらに検索

製品


リリース

R2016a

Community Treasure Hunt

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

Start Hunting!

Translated by