This week's book giveaway is in the Design forum.
We're giving away four copies of Building Microservices and have Sam Newman on-line!
See this thread for details.
The moose likes JDBC and Relational Databases and the fly likes Cannot Connect To MS-SqlServer 2008 R2 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Building Microservices this week in the Design forum!
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "Cannot Connect To MS-SqlServer 2008 R2" Watch "Cannot Connect To MS-SqlServer 2008 R2" New topic

Cannot Connect To MS-SqlServer 2008 R2

Khalil Salman

Joined: Sep 05, 2010
Posts: 11

I just started with Java,
I'm using Netbeans 6.9.1 as IDE, MS-SqlServer 2008 R2 as database server, and Struts 1.3.1 as framework...
The problem is that I just keep getting this error:

java.lang.UnsupportedOperationException: Java Runtime Environment (JRE) version 1.6 is not supported by this driver. Use the sqljdbc4.jar class library, which provides support for JDBC 4.0.

I downloaded the jdbc 3.0 from microsoft's web page. And I only added sqljdbc4.jar to my project. But strangely error message says that the driver you use is not supported by JDBC 4.0, so use sqljdbc4.jar.

Any idea?..
Any help would be really appreciated...
Khalil Salman

Joined: Sep 05, 2010
Posts: 11
I'm sorry guys but I've been fighting with this problem for last 3 days. No success.
But I just solved the problem.

In the beginning I had added jdbcsql4.jar as a jar file only..
But now I added a library to the project and I named that library as 'ms-jdbc'
Then I added jdbcsql4.jar to that new library which named ms-jdbc by me.

Strangely it worked out.
Campbell Ritchie

Joined: Oct 13, 2005
Posts: 44032
Nothing to be sorry about: well done sorting it out, and thank you for explaining it in case anybody else has a similar problem.

And welcome to JavaRanch
Have you checked out Aspose?
subject: Cannot Connect To MS-SqlServer 2008 R2
It's not a secret anymore!