ODBC connection problem with matlab and windows 7

  • Follow


Hello,

I am working with an application developed with Matlab that needs to connect in a database to load some information and display it. What the Matlab application does is connect to a SQL database by an ODBC connection.
I have been working with this application running it from the .m file under Matlab and also under a standalone version (.exe) of the application. To work with this executable version it's only necessary to have installed the MCR (Matlab Component Runtime) in a computer, and it's not necessary to have installed Matlab. This two versions have been working without any problem under Windows XP 32 bits and with a Matlab R2009b installed.

Now, I have tried to run the application under a Windows 7 64 bits and have appeared some problems of connectivity. These problems of connectivity are only with the application executed from the .m file in Matlab. The application starts without any problem but when it's necessary to start the connection appears an error. Instead, the executable version works without any problem. The only need to work with the executable version is run it as administrator. Then, it connects with the database and is possible to load all the data and display it.

I have read that in Windows 7 is possible to create an ODBC connection with a 32 bits version of the Odbcad32.exe and a 64 bits version, depending on the application to which you connect. In this case, I tried to configure a 32 bits connection and neither the matlab version nor the executable version works. With a 64 bits ODBC connection the executable version works correctly, running it as administrator. 

So what I suspect is that maybe it's an error from the permissions to start the connection, because if I don't run the executable version as administrator is not possible to start the connection (the same that happends when I run the application from the .m file). Is it possible? Maybe the problem is that under Matlab, if I run from the .m file, I don't have the permission to establish the ODBC connection, I can't run it as administrator.

Maybe you have some idea to try to solve this problem. If necessary, I can provide more information.

Sorry for my english, I know that is not very good.

Thank you very much to all of you.
0
Reply Jordi 10/29/2010 4:06:04 PM

You cannot mix 32/64 bit versions. Ask the support for more details.

Oleg
0
Reply Oleg 10/29/2010 5:53:03 PM


When you say that I can't mix 32/64 bits versions what do you mean? My Matlab is a 64 bits version. Then I have installed Microsoft SQL Server 2005 Express Edition SP3. Do you mean that this Microsoft SQL Server is a 32 bits version? Ant there is an incompatibility between SQL Server and Matlab? The strange is that the executable version of the application works perfectly... 
0
Reply Jordi7 11/1/2010 6:53:03 PM

When you say that I can't mix 32/64 bits versions what do you mean? My Matlab is a 64 bits version. Then I have installed Microsoft SQL Server 2005 Express Edition SP3. Do you mean that this Microsoft SQL Server is a 32 bits version? Ant there is an incompatibility between SQL Server and Matlab? The strange is that the executable version of the application works perfectly... 
0
Reply Jordi7 11/1/2010 6:54:04 PM

"Jordi7" wrote in message <iaerdc$ku3$1@fred.mathworks.com>...
> Hello,
> 
> I am working with an application developed with Matlab that needs to connect in a database to load some information and display it. What the Matlab application does is connect to a SQL database by an ODBC connection.
> I have been working with this application running it from the .m file under Matlab and also under a standalone version (.exe) of the application. To work with this executable version it's only necessary to have installed the MCR (Matlab Component Runtime) in a computer, and it's not necessary to have installed Matlab. This two versions have been working without any problem under Windows XP 32 bits and with a Matlab R2009b installed.
> 
> Now, I have tried to run the application under a Windows 7 64 bits and have appeared some problems of connectivity. These problems of connectivity are only with the application executed from the .m file in Matlab. The application starts without any problem but when it's necessary to start the connection appears an error. Instead, the executable version works without any problem. The only need to work with the executable version is run it as administrator. Then, it connects with the database and is possible to load all the data and display it.
> 
> I have read that in Windows 7 is possible to create an ODBC connection with a 32 bits version of the Odbcad32.exe and a 64 bits version, depending on the application to which you connect. In this case, I tried to configure a 32 bits connection and neither the matlab version nor the executable version works. With a 64 bits ODBC connection the executable version works correctly, running it as administrator. 
> 
> So what I suspect is that maybe it's an error from the permissions to start the connection, because if I don't run the executable version as administrator is not possible to start the connection (the same that happends when I run the application from the .m file). Is it possible? Maybe the problem is that under Matlab, if I run from the .m file, I don't have the permission to establish the ODBC connection, I can't run it as administrator.
> 
> Maybe you have some idea to try to solve this problem. If necessary, I can provide more information.
> 
> Sorry for my english, I know that is not very good.
> 
> Thank you very much to all of you.
0
Reply Rudy 12/21/2010 7:30:15 PM

"Jordi7" wrote in message <iaerdc$ku3$1@fred.mathworks.com>...
> Hello,
> 
> I am working with an application developed with Matlab that needs to connect in a database to load some information and display it. What the Matlab application does is connect to a SQL database by an ODBC connection.
> I have been working with this application running it from the .m file under Matlab and also under a standalone version (.exe) of the application. To work with this executable version it's only necessary to have installed the MCR (Matlab Component Runtime) in a computer, and it's not necessary to have installed Matlab. This two versions have been working without any problem under Windows XP 32 bits and with a Matlab R2009b installed.
> 
> Now, I have tried to run the application under a Windows 7 64 bits and have appeared some problems of connectivity. These problems of connectivity are only with the application executed from the .m file in Matlab. The application starts without any problem but when it's necessary to start the connection appears an error. Instead, the executable version works without any problem. The only need to work with the executable version is run it as administrator. Then, it connects with the database and is possible to load all the data and display it.
> 
> I have read that in Windows 7 is possible to create an ODBC connection with a 32 bits version of the Odbcad32.exe and a 64 bits version, depending on the application to which you connect. In this case, I tried to configure a 32 bits connection and neither the matlab version nor the executable version works. With a 64 bits ODBC connection the executable version works correctly, running it as administrator. 
> 
> So what I suspect is that maybe it's an error from the permissions to start the connection, because if I don't run the executable version as administrator is not possible to start the connection (the same that happends when I run the application from the .m file). Is it possible? Maybe the problem is that under Matlab, if I run from the .m file, I don't have the permission to establish the ODBC connection, I can't run it as administrator.
> 
> Maybe you have some idea to try to solve this problem. If necessary, I can provide more information.
> 
> Sorry for my english, I know that is not very good.
> 
> Thank you very much to all of you.

To the original poster, 
I was Just wondering if you have found a solution around your problem?
I am facing the same issue. I tried to deploy a matlab gui, with xp operating system. And, now having problem running the file on a 64-bit operating system!!

thanks, 
Rudy 
0
Reply Rudy 12/21/2010 7:33:05 PM

From what I understand you have to use the version of the driver which matches your computer type.  A 64-bit driver must be used with a 64-bit OS.  The issue I've run into is that Office 2010 puts the 64-bit MS Access driver into the 32-bit ODBC administrator.  The 32-bit ODBC Administrator is in C:\Windows\system32\odbcad32.exe and the 64-bit version is in C:\Windows\SysWOW64\odbcad32.exe.

Try to step through your code to see where it exactly fails.  Check conn and curs after each use to see if there's a message (conn.Message).  I believe at least one of the database functions may require administrator access to run.  If I remember correctly getdatasources use executes a registry export command to print a list of ODBC databases in an ODBC.INI file.
0
Reply Jeremy 1/10/2011 3:29:05 PM

6 Replies
894 Views

(page loaded in 0.075 seconds)

Similiar Articles:













7/20/2012 6:54:40 AM


Reply: