accessing Long Text from matlab

조회 수: 1 (최근 30일)
Aspire
Aspire 2017년 5월 10일
댓글: Guillaume 2017년 5월 12일
Is there any way to store and retrieve MS access Long text?
  댓글 수: 1
Rik
Rik 2017년 5월 11일
It sound like there probably is. Have you tried the steps on this page?

댓글을 달려면 로그인하십시오.

채택된 답변

Guillaume
Guillaume 2017년 5월 11일
I don't have any problem storing and retrieve LONGTEXT data from access, so you should explain what issues you've encountered.
However, note that I don't use (and don't have) the database toolbox to communicate with Access. The following works without any issues:
connection = actxserver('ADODB.connection'); %Use ADO to talk to Access
connection.Provider = 'Microsoft.ACE.OLEDB.12.0'; %Use Access engine
connection.Open([pwd, 'TestDb.accdb']); %Open existing database in local directory
connection.Execute('CREATE TABLE TestTableLT (Id COUNTER, Content LONGTEXT)'); %create table
connection.Execute(['INSERT INTO TestTableLT VALUES (1, "', char(randi(double('az'), 1, 1024)), '")']); %insert row with random 1024 characters
connection.Execute(['INSERT INTO TestTableLT VALUES (2, "', char(randi(double('az'), 1, 1024)), '")']); %insert row with random 1024 characters
recordset = connection.Execute('SELECT * FROM TestTableLT'); %retrieve rows
recordset.GetRows.' %get all rows (which are actually return as columns of a cell array, so transpose)
  댓글 수: 2
Aspire
Aspire 2017년 5월 12일
the i am using to retrieve is
  1. conn = database.ODBCConnection('Project','admin','admin');
  2. curs = exec(conn,'select * from info')
  3. curs = fetch(curs)
  4. ret = curs.Data
output for 3 is # ODBCCursor with properties:
Data: 0
RowLimit: 0
SQLQuery: 'select * from info'
Message: 'Out of memory. Type HELP MEMORY for your options.'
Type: 'ODBCCursor Object'
Statement: [1x1 database.internal.ODBCStatementHandle]
Guillaume
Guillaume 2017년 5월 12일
To me, the problem appears to be that the length of the text multiplied by the number of rows uses too much memory to be retrieved all at once. Hence you run out of memory.
Have you tried limiting the number of rows fetched at once (with a TOP statement in your sql, with the MaxRows option of the exec statement, with the rowlimit of your fetch statement, or the batchsize of the fetch statement)?

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Environment and Settings에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by