7

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?

mdeceglie
  • 968
  • 4
  • 14

2 Answers2

1

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,

ArgentoSapiens
  • 7,780
  • 1
  • 32
  • 49
pvanbijnen
  • 806
  • 6
  • 11
  • 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. – mdeceglie Oct 17 '14 at 15:12
1

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.

mdeceglie
  • 968
  • 4
  • 14