COM.ADODB connection error

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?

Réponses (1)

sm
sm le 20 Jan 2016

0 votes

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.

Catégories

En savoir plus sur Environment and Settings dans Centre d'aide et File Exchange

Question posée :

sm
le 5 Juin 2015

Réponse apportée :

sm
le 20 Jan 2016

Community Treasure Hunt

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

Start Hunting!

Translated by