MATLAB: Do I receive an error while running a 32 bit compiled application on 64bit operating system that uses ODBC connection

Database Toolbox

When I try to run a 32bit compiled application that connects to a database using ODBC-JDBC on a 64bit operating system with 32bit MCR, I receive the following error:
??? Undefined function or method 'fetch' for input arguments of type
'struct'.
MATLAB: UndefinedFunction.
However, I am able to successfully run my compiled application on a 32bit machine with 32bit MCR installed.

Best Answer

The issue might be due to the failure in creating a valid ODBC driver on your 64 bit machine. Following is the link from Microsoft on how to create an ODBC data source on a 64bit machine for a 32bit application. Please make sure that to follow the procedure specified in the link to ensure a proper creation of the data source on your 64bit machine:
<http://support.microsoft.com/kb/942976/en-us>
Also, please insert the following code in your MATLAB code and recompile it to check if the database connection object that is created is valid:
conn = database('sampledatabase','username','password')
if (~isconnection(conn))
str=conn.Message
h=errordlg(str,'Error','modal' );
while ishandle(h)
pause(.25)
end
error(str)
end
If you are using Vista with UAC turned on MATLAB will have to run as the administrator (right click on MATLAB icon and select 'Run as Administrator').