How to connect Microsoft SQL Server 2000 with Matlab R2011b?

3 views (last 30 days)
I used the code of the sql server 2005 in the demo, but one error was occured about "Driver Error".
  2 Comments
the cyclist
the cyclist on 9 Mar 2012
Two comments:
(1) It would be much more useful if you gave the complete text of the error message, and more detail about what you were doing. (For example, which demo, and what command causes the error.)
(2) My experience here is that database toolbox questions often don't get a high level of responsiveness. You might get a quicker resolution to your problem by contacting Mathworks support.
Mather Wang
Mather Wang on 12 Mar 2012
>> conn = database('wind','**','******', ...
'com.microsoft.sqlserver.jdbc.SQLServerDriver', ...
'jdbc:sqlserver://192.168.200.19:1433;database=wind')
conn =
Instance: 'wind'
UserName: 'sa'
Driver: []
URL: []
Constructor: [1x1 com.mathworks.toolbox.database.databaseConnect]
Message: [1x154 char]
Handle: 0
TimeOut: []
AutoCommit: 'off'
Type: 'Database Object'
>> conn.Message
ans =
JDBC Driver Error: com.microsoft.sqlserver.jdbc.SQLServerDriver. Driver Not Found/Loaded. Please verify that login information and database url are valid.
Our server system is SQL SERVER 2010. The parameters of database function is refered to the following help:
Connect to Microsoft SQL Server 2005
Establish a JDBC connection to the Microsoft SQL Server 2005 database:
conn = database('dbName','user','password', ...
'com.microsoft.sqlserver.jdbc.SQLServerDriver', ...
'jdbc:sqlserver://servername:portnumber;database=dbName')

Sign in to comment.

Accepted Answer

Mather Wang
Mather Wang on 12 Mar 2012
Download Microsoft SQL Server JDBC Driver 2.0. And configure it as following(demo information): Configure MATLAB to Use JDBC Drivers for Authenticated Database Connection
To connect to a SQL server database with integrated Windows authentication using a JDBC driver, do the following:
1.
Close MATLAB if it is running.
2.
Insert the path to the database driver JAR file in the classpath.txt file. The classpath.txt file is located at:
$MATLABROOT\toolbox\local\classpath.txt
The updated path entry should now include the full path to the driver. For example:
C:\DB_Drivers\sqljdbc_2.0\enu\sqljdbc4.jar
3.
Insert the path to the folder containing sqljdbc_auth.dll in the librarypath.txt file. The librarypath.txt file is located at:
$MATLABROOT\toolbox\local\librarypath.txt
The path entry should not include the file name sqljdbc_auth.dll:
C:\DB_Drivers\sqljdbc_2.0\enu\auth\x64
The sqljdbc_auth.dll file is installed in the following location:
<installation>\sqljdbc_<version>\<language>\auth\<arch>
where <installation> is the installation directory of the SQL server driver.
If you are running a 32-bit Java Virtual Machine (JVM), use the sqljdbc_auth.dll file in the x86 folder, even if the operating system is the x64 version. If you are running a 64-bit JVM on a x64 processor, use the sqljdbc_auth.dll file in the x64 folder. If you are running a 64-bit JVM on a IA-64 processor, use the sqljdbc_auth.dll file in the IA64 folder.
4.
Start MATLAB.
5.
Append the string integratedSecurity=true; to the database URL:
conn = database('dbName','','', ...
'com.microsoft.sqlserver.jdbc.SQLServerDriver', ...
['jdbc:sqlserver://servername:portnumber; '...
'database=dbName;'] 'integratedSecurity=true;')

More Answers (0)

Products

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!