COM.ADODB connection error

2 ビュー (過去 30 日間)
sm
sm 2015 年 6 月 5 日
回答済み: sm 2016 年 1 月 20 日
I am trying to connect to a MS Access database using the actxserver (64-bit version of MATLAB and MS Office).
conn = actxserver('ADODB.Connection');
conn.CursorLocation = 'adUseClient';
conn.Open('Provider=Microsoft.ACE.OLEDB.12.0;Data Source=H:\Database.accdb; Persist Security Info=False;);
rs = conn.Execute(sqlQuery); -> Error Line
The code works 90% of the time, but sometimes I get an error.
Error Message:
Error using COM.ADODB_Command/Execute
Error: Object returned error code: 0x214A14E8 (or 0xF6E01D00 etc. the number is not always the same)
Once the error occur, the only solution is to close Matlab and start a new session (simply re-running the script will result into another error every time).
The weird part is that while I was running the exact same script on 32-bit Maltab and 32-bit Access I never got any errors (note: when I upgrade the Office and Matlab, I deleted the 32-bit versions of both). Given that Maltab does not provide any documentation on COM.ADODB does anybody have any ideas what might be the source of the error and/or how to debug it?

回答 (1 件)

sm
sm 2016 年 1 月 20 日
It took me a while, but it turned out the issue was the date format in the database. Using the ODBC or OLEB connection MATLAB crashed, while using DAO the connection was stable.

カテゴリ

Help Center および File ExchangeEnvironment and Settings についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by