Link to home
Start Free TrialLog in
Avatar of jfz2004
jfz2004

asked on

MATLAB SQL SERVER DATABASE CONNECTION

Hi,

I am using MATLAB R2011a (64bit) and try to connect to SQL SERVER but keep getting connection error. Should I use ODBC or JDBC. How to use them to connect?

Thanks.

Jennifer
Avatar of Nakul Vachhrajani
Nakul Vachhrajani
Flag of India image

I would use ODBC to connect to SQL Server. What's the error that you are facing?
Avatar of jfz2004
jfz2004

ASKER

Thanks,
My ODBC is 64bit too. But I get this:

ans =

[Microsoft][ODBC Driver Manager] Invalid string or buffer length Please verify that login information and database url are valid.

My co-worker uses 32 bit for both MATLAB and ODBC driver and it works.

But I have to use 64 bit.
Looks like there is a general issue with Mathworks and 64-bit versions of the ODBC driver: http://www.mathworks.com/matlabcentral/newsreader/view_thread/308517

and

http://www.mathworks.com/matlabcentral/answers/93553-why-do-i-get-the-error-invalid-string-or-buffer-length-when-using-an-odbc-driver-with-the-database (This 2nd link also contains a URL to the MatLab documentation for database connectivity).
Avatar of jfz2004

ASKER

Thanks. But the 2nd link does not allow me to access the answer. It requires a license number. I entered the license number, it says that license already has a user. So I am following JDBC. But it is so complex that it needs me to create a file called javalibrarypath.txt in a folder that does not even exist on my C:\ drive.

I am so frustrated.
Avatar of jfz2004

ASKER

According to MatLab's instruction, I need to 2 run the prefdir command in the MATLAB Command Window. The output of this command is a file path to a folder on your computer. But that folder is not on my computer C:\ drive.
Are you referring to the C:\DB_Drivers folder shown as an example on the page: http://in.mathworks.com/help/database/ug/microsoft-sql-server-jdbc-windows.html?
I believe that folder is created as a part of the driver deployment and that it can be changed by the user.
ASKER CERTIFIED SOLUTION
Avatar of yuk99
yuk99
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of jfz2004

ASKER

Thank you. Will try it.
Avatar of jfz2004

ASKER

Hi,

Thanks for the help, yuk99. I tried the instructions on the link: http://www.mathworks.com/help/database/ug/microsoft-sql-server-jdbc-windows.html#bt8kmbi-3

But at step 5, Set up the data source using Database Explorer.
I cannot find Database Explorer on my MATLAB R2011a.
Where is the Database Explorer. I really don't like the different incompatible versions!

Please somebody, how to find the Database Explorer on R2011a. Thank you!
Jennifer
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of jfz2004

ASKER

Thanks. But I cannot access to the links. I have a license but the end user is not me. I have to change end users which will take at least two days.
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of jfz2004

ASKER

I got it after numerous tries.
Now I an including this "integratedSecurity=true" in the URL and it worked!