COM.ADODB connection error

11 views (last 30 days)
sm
sm on 5 Jun 2015
Answered: sm on 20 Jan 2016
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?

Answers (1)

sm
sm on 20 Jan 2016
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.

Categories

Find more on Startup and Shutdown in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!