MATLAB: Do I receive an error when working with MDAC on Windows XP SP3 in MATLAB 7.11 (R2010b)


The following script works fine in older MATLAB version and on newer Windows versions, but in MATLAB 7.11 (R2010b) on Windows XP SP3 throws an error:
conn = actxserver('ADODB.Connection')
conn.ConnectionString = 'DRIVER={SQL Server};SERVER=localhost\SQLExpress;DATABASE=master' % update servername as/if needed
command = actxserver('ADODB.Command')
command.ActiveConnection = conn
??? Error: Object returned error code: 0xFFFFFFFE

Best Answer

  • There is an incompatibility between MDAC in Windows XP SP3 and the Microsoft Visual C++ redistributable used by MATLAB. This leads to an error being thrown when running the code given above. Please note however that the command is actually correctly set and it can be used to perform an action on the database. So to work around the issue simply place the commands between a TRY-CATCH and on an error simply continue.