This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes JDBC 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 The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Cannot Connect To MS-SqlServer 2008 R2" Watch "Cannot Connect To MS-SqlServer 2008 R2" New topic
Author

Cannot Connect To MS-SqlServer 2008 R2

Khalil Salman
Greenhorn

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
Greenhorn

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
Sheriff

Joined: Oct 13, 2005
Posts: 38412
    
  23
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
 
jQuery in Action, 2nd edition
 
subject: Cannot Connect To MS-SqlServer 2008 R2