Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
ado_command ('Communicate the connection object to the command object')

Subject: ado_command ('Communicate the connection object to the command object')

From: Jesper Find Nielsen

Date: 6 Apr, 2011 07:20:19

Message: 1 of 4

I am using the code below, on Matlab2008b it works fine, in Matlab2010b I get the following error:
??? Error: Object returned error code: 0xFFFFFFFE

Error in ==> myblob_command at 33
ado_command.ActiveConnection = ado_connection;

Error in ==> myblob_show_db at 47
Cell_Show_DB = myblob_command(ado_connection, 'show databases')';

Is there a fix for this?

%%%

function Cell_Show_DB = myblob_show_db(user, password, server)

connection_string = [ ...
    'driver=MySQL ODBC 3.51 Driver; ' ...
    'server=' server '; ' ...
    'uid=' user '; ' ...
    'pwd=' password '; ' ...
    'option=16427'];

% Instantiate ADO connection object
ado_connection = actxserver ('ADODB.Connection');

% Communicate the connection string to the connection object
ado_connection.ConnectionString = connection_string;

% Use client-side cursors.
% This is necessary for MYBLOB_TO_DB
ado_connection.CursorLocation = 'adUseClient';

% Open the connection object
ado_connection.Open;

Cell_Show_DB = myblob_command(ado_connection, 'show databases')';

myblob_close(ado_connection);

%%%%

function cell_array = myblob_command (ado_connection, command)

%disp('Instantiate ADO command object');
ado_command = actxserver('ADODB.Command');

%disp('Communicate the sql command string to the command object');
ado_command.CommandText = command;

%disp('Communicate the connection object to the command object');
ado_command.ActiveConnection = ado_connection;

Subject: ado_command ('Communicate the connection object to the command object')

From: Neil

Date: 21 Sep, 2011 00:37:29

Message: 2 of 4

"Jesper Find Nielsen" wrote in message <inh47j$641$1@fred.mathworks.com>...
> I am using the code below, on Matlab2008b it works fine, in Matlab2010b I get the following error:
> ??? Error: Object returned error code: 0xFFFFFFFE
>
> Error in ==> myblob_command at 33
> ado_command.ActiveConnection = ado_connection;
>
> Error in ==> myblob_show_db at 47
> Cell_Show_DB = myblob_command(ado_connection, 'show databases')';
>
> Is there a fix for this?
>
> %%%
>
> function Cell_Show_DB = myblob_show_db(user, password, server)
>
> connection_string = [ ...
> 'driver=MySQL ODBC 3.51 Driver; ' ...
> 'server=' server '; ' ...
> 'uid=' user '; ' ...
> 'pwd=' password '; ' ...
> 'option=16427'];
>
> % Instantiate ADO connection object
> ado_connection = actxserver ('ADODB.Connection');
>
> % Communicate the connection string to the connection object
> ado_connection.ConnectionString = connection_string;
>
> % Use client-side cursors.
> % This is necessary for MYBLOB_TO_DB
> ado_connection.CursorLocation = 'adUseClient';
>
> % Open the connection object
> ado_connection.Open;
>
> Cell_Show_DB = myblob_command(ado_connection, 'show databases')';
>
> myblob_close(ado_connection);
>
> %%%%
>
> function cell_array = myblob_command (ado_connection, command)
>
> %disp('Instantiate ADO command object');
> ado_command = actxserver('ADODB.Command');
>
> %disp('Communicate the sql command string to the command object');
> ado_command.CommandText = command;
>
> %disp('Communicate the connection object to the command object');
> ado_command.ActiveConnection = ado_connection;


Hi Jesper

I am running into the same issue. I took it up with the mathworks support, but go the "this isn't something we support" reply.

We suspect it has something to do with the version of the ado_connection and ado_command being different, but not sure how to fix it.

Have you had any luck?

Cheers
Neil

Subject: ado_command ('Communicate the connection object to the command object')

From: Dan

Date: 22 Nov, 2011 10:22:08

Message: 3 of 4

"Jesper Find Nielsen" wrote in message <inh47j$641$1@fred.mathworks.com>...
> I am using the code below, on Matlab2008b it works fine, in Matlab2010b I get the following error:
> ??? Error: Object returned error code: 0xFFFFFFFE
>
> Error in ==> myblob_command at 33
> ado_command.ActiveConnection = ado_connection;
>
> Error in ==> myblob_show_db at 47
> Cell_Show_DB = myblob_command(ado_connection, 'show databases')';
>
> Is there a fix for this?
>
> %%%
>
> function Cell_Show_DB = myblob_show_db(user, password, server)
>
> connection_string = [ ...
> 'driver=MySQL ODBC 3.51 Driver; ' ...
> 'server=' server '; ' ...
> 'uid=' user '; ' ...
> 'pwd=' password '; ' ...
> 'option=16427'];
>
> % Instantiate ADO connection object
> ado_connection = actxserver ('ADODB.Connection');
>
> % Communicate the connection string to the connection object
> ado_connection.ConnectionString = connection_string;
>
> % Use client-side cursors.
> % This is necessary for MYBLOB_TO_DB
> ado_connection.CursorLocation = 'adUseClient';
>
> % Open the connection object
> ado_connection.Open;
>
> Cell_Show_DB = myblob_command(ado_connection, 'show databases')';
>
> myblob_close(ado_connection);
>
> %%%%
>
> function cell_array = myblob_command (ado_connection, command)
>
> %disp('Instantiate ADO command object');
> ado_command = actxserver('ADODB.Command');
>
> %disp('Communicate the sql command string to the command object');
> ado_command.CommandText = command;
>
> %disp('Communicate the connection object to the command object');
> ado_command.ActiveConnection = ado_connection;

Subject: ado_command ('Communicate the connection object to the command object')

From: Dan

Date: 22 Nov, 2011 10:34:08

Message: 4 of 4

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.
 

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us