3

We have recently migrated to SQL server 2014 with JAVA 5 on one machine and JAVA 6 on another (this is a requirement). When I try to connect to database I get follwoing exception.

org.jboss.resource.JBossResourceException: Could not create connection; - nested throwable: (
       com.microsoft.sqlserver.jdbc.SQLServerException:
             The server version is not supported.
             The target server must be SQL Server 2000 or later.
       )
    at org.jboss.resource.adapter.jdbc.local.LocalManagedConnectionFactory.createManagedConnection(LocalManagedConnectionFactory.java:168)
    at org.jboss.resource.connectionmanager.InternalManagedConnectionPool.createConnectionEventListener(InternalManagedConnectionPool.java:508)
    at org.jboss.resource.connectionmanager.InternalManagedConnectionPool.getConnection(InternalManagedConnectionPool.java:207)

Following is the configuration:

  • OS: Windows server 2012
  • SQL server 2014
  • JAVA version: JDK5u11 and JDK6u24
  • Jar file: sqljdbc.jar for JDK5 and sqljdbc4.jar for JDK6
rolfl
  • 17,539
  • 7
  • 42
  • 76
Nayan Sonthalia
  • 237
  • 1
  • 4
  • 22
  • Which version of the MS JDBC are you using? It might be too old, try using `Microsoft SQL Server JDBC Driver 4.1 for SQL Server` if you don't already. – jpw Dec 22 '14 at 15:00

2 Answers2

2

You will need to upgrade your SQL Server JDBC driver to at least version 4.0 (download here). Then you can use its versions of

  • sqljdbc.jar for Java 5, and
  • sqljdbc4.jar for Java 6

to access SQL Server 2014.

Gord Thompson
  • 116,920
  • 32
  • 215
  • 418
  • 1
    Thanks.. we upgraded the jar to sqljdbc4.jar and it worked like a charm. – Nayan Sonthalia Dec 23 '14 at 07:02
  • we ran into an issue with sqljdbc4.jar where the composit queried were not working properly becase of some changes by microsoft. I had a select statement running inside a insert, this resulted in no result set being returened to the application and an exception in java. When we debugged more, we found that microsoft has changed the way sqljdbc4.jar works for composit queried. So we used jtds jar insted and all the problems were resolved. Follow the link for more details ----- http://stackoverflow.com/questions/28022701/running-composite-query-on-sql-server-2014-does-not-return-result-set. – Nayan Sonthalia Feb 05 '15 at 07:56
  • We successfully converted a very large project using ORM, Stored Procedures and JDBC queries from JTDS to sqljdbc4 driver. We did encounter one issue, where JTDS was tolerant of but sqljdbc is not, and that is the need for the SET NOCOUNT ON; statement in most stored procedures and many sql statements that are expected to return data but may not return any results. For more info on this concept, see: http://stackoverflow.com/questions/1483732/set-nocount-on-usage – pczeus Sep 30 '16 at 21:12
  • For SQL Server 2016 an Java 8, should sqljdbc4.be upgraded? – PC. Apr 03 '19 at 04:09
0

We discarded the sqljdnc4.jar and used jtds jar instead and everything works like a charm.

cнŝdk
  • 31,391
  • 7
  • 56
  • 78
Nayan Sonthalia
  • 237
  • 1
  • 4
  • 22
  • depending on your application jtds may have other issues – Henno Vermeulen Jun 22 '15 at 09:40
  • @HennoVermeulen: After changing the drive we did a sanity of the entire application including the performance and did not face any issues. But you are correct, other applications might have issues when they change the drive to jtds. – Nayan Sonthalia Aug 06 '15 at 08:03
  • Also note that according to the jtds developer, the jtds driver is now deprecated due to the advancements made available int the microsoft driver. No new development is being done on the jtds project and they recommend now switching to the ms driver. – pczeus Sep 08 '16 at 14:17
  • @pczeus do you have a source/link for that info about jtds? – 8forty Sep 30 '16 at 20:49
  • Last release was 1.3.1 released on 6/8/2013. Last commit was on 11/14/2014. There's a thread on the JTDS discussion section of SourceFourge here: https://sourceforge.net/p/jtds/discussion/129584/thread/050f9892/ momo describes: "jTDS is no longer developed actively. I have been the last active developer for years, but currently I don't see how to continue work. I still hope things may change again... who knows. Furthermore, the Sybase and Microsoft drivers are much better now (while still far from perfect, of course) and most of the reasons for using an alternate driver have become obsolete." – pczeus Sep 30 '16 at 21:04