4
$\begingroup$

This question already has an answer here:

Having installed sql server 2016 evaluation copy.

I have setup a sample database using sql server management studio.

Typed the following in mathematica

Needs["DatabaseLink`"];

JDBCDrivers["Microsoft SQL Server(jTDS)"];

No error in the output of the two commands. MS SQL Server is using windows authentication for login.

OpenSQLConnection[
 JDBC["Microsoft SQL Server (jTDS)", "server/database"], 
 "Username" -> "user", "Password" -> "password"]

gives the following error

JDBC::classnotfound: Microsoft SQL Server (jTDS) >>
$Failed

Please help i am a new to this. Just learned sql server and now want to integrate it into mathematica.

Also are there any tutorial on DatabaseLink package of mathematica

After following the instruction on the other post i still get the same error

JDBC::classnotfound: Microsoft SQL Server (jTDS) >>
$Failed

Also for windows authentication should i just use the following then right?

OpenSQLConnection[
 JDBC["Microsoft SQL Server (jTDS)", "server/database"]]

The server name is DESKTOP-4SGK8AQ and database name is LearningSQL so i am using the following code

OpenSQLConnection[
 JDBC["Microsoft SQL Server (jTDS)", "DESKTOP-4SGK8AQ/LearningSQL"]]

Everything works now "Microsoft SQL Server (jTDS)" should be corrected to "Microsoft SQL Server(jTDS)". My mistake

$\endgroup$

marked as duplicate by Edmund, m_goldberg, Öskå, user9660, MarcoB Dec 25 '15 at 18:24

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • $\begingroup$ With Windows Authentication you need to download a jTDS dll file. Read this post. Also, note that you should not set the Username and Password in the connection when using Windows Authentication. $\endgroup$ – Edmund Dec 25 '15 at 14:50
  • $\begingroup$ Followed the instruction on the post still the same error: JDBC::classnotfound: Microsoft SQL Server (jTDS) >> $Failed $\endgroup$ – user13892 Dec 25 '15 at 15:12
  • $\begingroup$ There is a 32bit and a 64bit version of the file. You have to put the right version in the correct Java directory. You should check it works with 2014 as well. In case it is a bug with Mathematica and 2016. You can get SQL Server Express 2014 is free. $\endgroup$ – Edmund Dec 25 '15 at 15:34
  • $\begingroup$ Ok i am installing the 2014 version of sql server and will try again. Are you sure it works with 2014 right? $\endgroup$ – user13892 Dec 26 '15 at 5:29
  • $\begingroup$ Yes. I use it with 2014 Express at home and 2014 at work. $\endgroup$ – Edmund Dec 26 '15 at 5:39