Skip to content
Advertisement

“NoClassDefFoundError: javax/xml/bind/DatatypeConverter” with SQL Server JDBC

I recently switched to intellij but I’m finding it hard to connect to my localDB. The same code worked on eclipse fine. Also I have already added the sqljdbc42.jar as a module dependency.

JavaScript

Error produced:

JavaScript

Any help would be greatly appreciated. I’ve also tried the overloaded DriverManager.getConnection(url, user, pass) method and same error.

Advertisement

Answer

For Java 9+ compatibility, you need to use version 6.4.0 or higher for the Java version you use as identified by the jreXX version suffix. Use the highest version lower or equal to you Java version).


Previous answer

As noted by Microsoft on GitHub:

Currently none of our driver released Jars are compatible with JDK9.

You can either switch to using the Java 8 JDK, or you can incorporate Microsoft’s development code from their ‘JDBC4.3’ branch into your project and use that with the Java 9 JDK.

Advertisement