Why does MATLAB return errors when connecting to SQL Server database using Database Toolbox 3.6 (R2009b) on a 64-bit Windows machine?
1 view (last 30 days)
Show older comments
I have a SQL Server database hosted on a remote machine. I am running 32-bit MATLAB version on a 64-bit Windows machine. I have created a System DSN datasource for this database from the ODBC Data Administrator. I am an adminstrator of the local machine and when I execute the 'getdatasources' command, I do not see the created datasource. To locate the data sources available, I executed the following command to make MATLAB use the 'odbc.ini' file, existing in the directory pointed by WINDIR environment variable, and not the registry:
setdbprefs('UseRegistryForSources','no');
Now, when I execute the following command
getdatasources
I get the datasource listed in the results. However, when I try connecting to the created data source, I receive the following error:
conn.Message = [Microsoft][ODBC Driver Manager] Data source name not
found and no default driver specified
How do I resolve this issue?
Accepted Answer
MathWorks Support Team
on 13 Nov 2009
In a 64-bit machine, there are two versions of ODBC drivers. I.e. the 32-bit version and the 64-bit version. So you have to setup the drivers in both places to make it work for both 32-bit and 64-bit applications. The driver that you setup by using control panel (Start - Admin Tools - Data Sources) is for controlling the 64-bit version. However, we need to setup the 32-bit driver since the installed MATLAB is a 32-bit application. To do this, run the following executable:
C:\Windows\SysWOW64\odbcad32.exe
0 Comments
More Answers (0)
See Also
Categories
Find more on Database Toolbox in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!