wood burning stoves 2.0*
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
JavaRanch » Java Forums » Databases » JDBC
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: 38107
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
It is sorta covered in the JavaRanch Style Guide.
subject: Cannot Connect To MS-SqlServer 2008 R2
Similar Threads
SQLServerException: TCP/IP connection to the host has failed.
No suitable driver found for JDBC
exception while running my first jdbc code
com.microsoft.sqlserver.jdbc.SQLServerException: The TDS protocol stream is not valid.
Reg: Encoding the european character data