7
$\begingroup$

After upgrading to version 10, functions relying on a connection to a Microsoft SQL database no longer work. When I attempt to open a connection with something like:

Needs["DatabaseLink`"]
conn = OpenSQLConnection[JDBC["Microsoft SQL Server(jTDS)", "server:port/DBName"],
"Username" -> "user", "Password" -> "pass"]

I receive the error:

JDBC::error: net/sourceforge/jtds/jdbc/Driver : Unsupported major.minor version 51.0

I have verified that this still returns a SQLConnection with Mathematica 9. Other SQL connections (i.e. mysql) are still working for me in Mathematica 10. I still get the error if my machine is not connected to the network, so it can't be an interaction with the remote server. I'm running OS X 10.8.5.

How can I connect to the Microsoft SQL server with the new version of Mathematica?

$\endgroup$
1
$\begingroup$

I have Mathematica 10 running with SQL Server 2012 and it works fine. This is how I make the connection:

Needs["DatabaseLink`"] (*needed *)
conn = OpenSQLConnection[
  JDBC["Microsoft SQL Server(jTDS)", "servername:portnr/databasename"], 
  "Username" -> "username", "Password" -> "password"]

A SQLConnection object is returned.

Use DatabaseExplorer[] to test different settings if you like working via a userinterface.

need more details if this does not work.

Kind regards,

$\endgroup$
  • $\begingroup$ Thanks for the comment, I have updated the questions with some more details. It appears we are both using the same approach but it isn't working for me. $\endgroup$ – mdeceglie Oct 17 '14 at 15:12
1
$\begingroup$

The problem was that the init.m file was causing the system version of Java (in my case 6) to override version 7 which shipped with Mathematica 10. The problematic lines in my init.m files were intended to increase the memory available to java:

<<JLink`;
InstallJava[];
ReinstallJava[CommandLine->"java",JVMArguments->"-Xmx4096m"];

The command line option is installing the system default version of java. To remedy this they can be updated to:

<<JLink`;
InstallJava[];
ReinstallJava[CommandLine->"/Applications/Mathematica.app/SystemFiles/Links/JLink/JLink.app/Contents/MacOS/Launcher", JVMArguments->"-Xmx4096m"];

This uses the path to version of java that shipped with Mathematica 10.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.