jTDS connectivity to SQL Server: Unsupported major.minor version 51.0

I'm trying to connect to a database (SQL Server 2008) via the jTDS driver. (Running MacOSX 10.8.3.) PyCharm downloads automatically version 1.3. Connecting to the DB fails because:

Connection to Exception in thread "main" java.lang.UnsupportedClassVersionError: net/sourceforge/jtds/jdbc/Driver : Unsupported major.minor version 51.0
 at java.lang.ClassLoader.defineClass1(Native Method)
 at java.lang.ClassLoader.defineClass1(Native Method)
 at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631)
 at java.lang.ClassLoader.defineClass(ClassLoader.java:615)
 at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
 at java.net.URLClassLoader.defineClass(URLClassLoader.java:283)
 at java.net.URLClassLoader.access$000(URLClassLoader.java:58)
 at java.net.URLClassLoader$1.run(URLClassLoader.java:197)
 at java.security.AccessController.doPrivileged(Native Method)
 at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
 at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
 at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
 at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
 at java.lang.Class.forName0(Native Method)
 at java.lang.Class.forName(Class.java:171)
 at com.intellij.persistence.database.console.RemoteJdbcServer.main(RemoteJdbcServer.java:15)

The error seems to pop up because the jdk I have installed (1.6) is incompatible with the jTDS driver version.

Fair enough. I updated my java (jdk 1.7) and set the java home variable to point to the new location. I also verified that the symbolic link in /usr/local/bin was updated by checking the version at the command line.

Yet the error persists.

Is there any way to make this work?

As an aside, I'd also like to point out that having to upgrade my java JUST to support a new DB driver kind of irks me (if this is the case, which it seems to be). It would be nice if I could just use one of the half-dozen jTDSs that I already have downloaded, and which provide fine DB connectivity. But the UI gives me no other option. Also there may be a bug in this widget, the error messages persist in the UI as I navigate through the tabs "Database", "Schema & Tables", etc., see shot below:

1 comment
Comment actions Permalink
To enable using a driver compiled with JDK 7, you need to run PyCharm under JDK 7. There are some known issues, though, such as lack of Retina display support.
You can find the instructions for running PyCharm under JDK 7 at http://intellij-support.jetbrains.com/entries/23455956

Please sign in to leave a comment.