Eclipse – Data Source Explorer – SQL Server – Configuration ( Day 01 )

Background

Ran into a blocking issue while playing around with Eclipse.

The issue surfaced while trying to configure Hibernate to connect to SQL Server.

 

Data Source Explorer

I tried using the Hibernate Data Tools to connect to my back-end database; SQL Server in this case.

Finally gave up and wanted to see if I can reproduce the error using other data tools.

Process

Outline

  1. Perspective
    • Change to Data Development Perspective
  2. Driver Templates
    • Does Not Work
      • Microsoft SQL Server 2016 JDBC Driver
        • Specify a Driver Template and Definition Name
          • Driver Name :- Microsoft SQL Server 2016 JDBC Driver
          • Driver Type :- Microsoft SQL Server 2016 JDBC Driver
        • Tab :- JAR List
          • Removed
            • Removed sqljdbc.jar
          • Added
            • Added mssql-jdbc-7.0.0.jre10.jar
        • Tab :- Properties
          • Filled out properties tab
        • Tested Connection
          • Errors Out
            • java.lang.UnsupportedClassVersionError: com/microsoft/sqlserver/jdbc/SQLServerDriver has been compiled by a more recent version of the Java Runtime (class file version 54.0), this version of the Java Runtime only recognizes class file versions up to 52.0
    • Works
      • Microsoft SQL Server 2008 JDBC Driver
        • Specify a Driver Template and Definition Name
          • Driver Name :- Microsoft SQL Server 2008 JDBC Driver
          • Driver Type :- Microsoft SQL Server 2008 JDBC Driver
        • Tab :- JAR List
          • Removed
            • Removed sqljdbc.jar
          • Added
            • Added mssql-jdbc-7.0.0.jre8.jar
        • Tab :- Properties
          • Filled out properties tab
        • Tested Connection
          • Ping Successful
  3. Data Explorer
    • Review Data Explorer

Perspective

Database Development

Image

perspective.OpenPerspective.01.20190505.1033PM.PNG

Connection Profile

Driver Templates

Driver Templates – v 2016

Image
Image – Connection Profile

connectionProfile.01.20190505.1052PM.PNG

Image – Specify a Driver Template and Definition Name – Tab – Name/Type

DriverTemplateAndDriverName.Tab.NameAndType.01.20190505.1059PM.PNG

Image – Specify a Driver Template and Definition Name – Tab – JAR List – 01

DriverTemplateAndDriverName.Tab.JARList.01.20190505.1100PM.PNG

Image – Specify a Driver Template and Definition Name – Tab – JAR List – 02

Removed sqljdbc.jar

DriverTemplateAndDriverName.Tab.JARList.02.20190505.1101PM.PNG

Image – Specify a Driver Template and Definition Name – Tab – JAR List – 04

Added mssql-jdbc-7.0.0.jre10.jar

DriverTemplateAndDriverName.Tab.JARList.03.20190505.1121PM.PNG

Image – Specify a Driver Template and Definition Name – Tab – Properties – 01

Review Properties Tab

DriverTemplateAndDriverName.Tab.Properties.01.20190505.1104PM.PNG

Image – Specify a Driver Template and Definition Name – Tab – Properties – 02

Completed Properties Tab

DriverTemplateAndDriverName.Tab.Properties.02.20190505.1105PM.PNG

Image – Specify a Driver and Connection Details

Review Driver and Connection Details ….

connectionProfile.jre10.01.SpecifyADriverAndConnectionDetails.02.20190505.1118PM.PNG

Image – Ping failed!

Ping failed.

pingFailed.20190505.1120PM.PNG

Ping failed.

java.lang.UnsupportedClassVersionError: com/microsoft/sqlserver/jdbc/SQLServerDriver has been compiled by a more recent version of the Java Runtime (class file version 54.0), this version of the Java Runtime only recognizes class file versions up to 52.0
	at java.lang.ClassLoader.defineClass1(Native Method)
	at java.lang.ClassLoader.defineClass(Unknown Source)
	at java.security.SecureClassLoader.defineClass(Unknown Source)
	at java.net.URLClassLoader.defineClass(Unknown Source)
	at java.net.URLClassLoader.access$100(Unknown Source)
	at java.net.URLClassLoader$1.run(Unknown Source)
	at java.net.URLClassLoader$1.run(Unknown Source)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.net.URLClassLoader.findClass(Unknown Source)
	at java.lang.ClassLoader.loadClass(Unknown Source)
	at java.net.FactoryURLClassLoader.loadClass(Unknown Source)
	at java.lang.ClassLoader.loadClass(Unknown Source)
	at org.eclipse.datatools.connectivity.drivers.jdbc.JDBCConnection.createConnection(JDBCConnection.java:327)
	at org.eclipse.datatools.connectivity.DriverConnectionBase.internalCreateConnection(DriverConnectionBase.java:105)
	at org.eclipse.datatools.connectivity.DriverConnectionBase.open(DriverConnectionBase.java:54)
	at org.eclipse.datatools.connectivity.drivers.jdbc.JDBCConnection.open(JDBCConnection.java:96)
	at org.eclipse.datatools.enablement.msft.internal.sqlserver.connection.JDBCSQLServerConnectionFactory.createConnection(JDBCSQLServerConnectionFactory.java:27)
	at org.eclipse.datatools.connectivity.internal.ConnectionFactoryProvider.createConnection(ConnectionFactoryProvider.java:83)
	at org.eclipse.datatools.connectivity.internal.ConnectionProfile.createConnection(ConnectionProfile.java:359)
	at org.eclipse.datatools.connectivity.ui.PingJob.createTestConnection(PingJob.java:76)
	at org.eclipse.datatools.connectivity.ui.PingJob.run(PingJob.java:59)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:63)

Driver Templates – v 2008

Image
Image – Connection Profile

connectionProfile.01.20190505.1052PM.PNG

Image – Specify a Driver Template and Definition Name – Tab – Name/Type

Please choose “Microsoft SQL Server 2008 JDBC Driver

ConnectionProfile.SpecifyADriverAndDefinitionName.Tab.NameAndType.01.20190505.1112PM.PNG

Image – Specify a Driver Template and Definition Name – Tab – JAR List – 01

DriverTemplateAndDriverName.Tab.JARList.01.20190505.1100PM.PNG

Image – Specify a Driver Template and Definition Name – Tab – JAR List – 02

Removed sqljdbc.jar

DriverTemplateAndDriverName.Tab.JARList.02.20190505.1101PM.PNG

Image – Specify a Driver Template and Definition Name – Tab – JAR List – 03

Using the OS “Select the file” functionality reach for mssql-jdbc-7.0.0.0.jre8.jarpingSucceedded.20190505.1124PM.PNG.

DriverTemplateAndDriverName.Tab.JARList.SelectTheFile.03.20190505.1122PM.PNG

 

Image – Specify a Driver Template and Definition Name – Tab – JAR List – 04

Added mssql-jdbc-7.0.0.jre8.jar

DriverTemplateAndDriverName.Tab.JARList.04.20190505.1123PM.PNG

Image – Specify a Driver Template and Definition Name – Tab – Properties – 01

Review Properties Tab

DriverTemplateAndDriverName.Tab.Properties.01.20190505.1104PM.PNG

Image – Specify a Driver Template and Definition Name – Tab – Properties – 02

Completed Properties Tab

DriverTemplateAndDriverName.Tab.Properties.02.20190505.1105PM.PNG

Image – Specify a Driver and Connection Details

Review Driver and Connection Details ….

connectionProfile.jre10.01.SpecifyADriverAndConnectionDetails.02.20190505.1118PM.PNG

Image – Test Connection

Tested Connection

pingSucceedded.20190505.1124PM.PNG

 

Issues

Java Runtime Compatibility ( JRE )

Hibernate

Compatibility Matrix

Hibernate Compatibility Matrix is available here.

Image

compatibilityMatrix.01.20190506.1250AM

Explanation
  1. Hibernate ORM
    • v6.0
      • Java 8 or 11
    • v5.4
      • Java 8 or 11

Microsoft JDBC Driver

mssql-jdbc-7.0.0.jre10.jar

Naming Convention

The name, mssql-jdbc-7.0.0.jre10.jar, is telling :-

  1. mssql
  2. jdbc
  3. 7.0.0
    • Version of MSSQL/JDBC is 7
  4. jre10
    • Requires Java Runtime 10
  5. jar
    • Jar File
Implication
  1. mssql-jdbc-7.0.0.jre10.jar requires Java JRE 10
    • Hibernate does not support JRE 10
      • It appears we have an incompatibility

mssql-jdbc-7.0.0.jre8.jar

Naming Convention

The name, mssql-jdbc-7.0.0.jre8.jar, is telling :-

  1. mssql
  2. jdbc
  3. 7.0.0
    • Version of MSSQL/JDBC is 7
  4. jre8
    • Requires Java Runtime 8
  5. jar
    • Jar File
Implication
  1. mssql-jdbc-7.0.0.jre8.jar requires Java JRE 8
    • Hibernate does support JRE 8
      • It appears we are good with compatibility

 

 

Data Explorer

Images

Image – Data Explorer – 01

DataSourceExplorer.02.20190505.1126PM.PNG

Dedicate

Always a dedicated piece.

This time it is Kenji Hasunuma.

  1. Kenji Hasunuma
    • How to connect to SQL Server 2016 by Eclipse DTP (en)
      Link

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s