com.microsoft.sqlserver.jdbc.SQLServerException: The server version is not suppo

问题描述
com.microsoft.sqlserver.jdbc.SQLServerException: The server version is not supported. The target server must be SQL Server 2000 or later.
	at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDriverError(Unknown Source)
	at com.microsoft.sqlserver.jdbc.DBComms.Prelogin(Unknown Source)
	at com.microsoft.sqlserver.jdbc.DBComms.<init>(Unknown Source)
	at com.microsoft.sqlserver.jdbc.SQLServerConnection.connectHelper(Unknown Source)
	at com.microsoft.sqlserver.jdbc.SQLServerConnection.loginWithoutFailover(Unknown Source)
	at com.microsoft.sqlserver.jdbc.SQLServerConnection.connect(Unknown Source)
	at com.microsoft.sqlserver.jdbc.SQLServerDriver.connect(Unknown Source)
	at java.sql.DriverManager.getConnection(DriverManager.java:582)
	at java.sql.DriverManager.getConnection(DriverManager.java:185)
	at com.zuxia.util.DBUtil.getConn(DBUtil.java:40)
	at com.zuxia.dao.GoodsTypeDao.getAllGoodType(GoodsTypeDao.java:25)
	at org.apache.jsp.index_jsp._jspService(index_jsp.java:186)


此问题一直搁置,源文件也不见了,今天发现就拿了上来....解决方案未亲测。放在这里做个记号。

解决方案
已经有人出现过了,so... http://www.skill-guru.com/blog/2010/04/05/jboss-4-server-configuration-for-sql-server-2008/
After spending some time , I found that this issue will normally occur when you are using a older verison of JDBC driver to connect to sql server 2008. So make sure you are using sql server 2008 JDBC driver and you do not have sqlserver 2005 JDBC drivers in the classpath or in server/default/lib folder.

When you download the SQlserver 2008 JDBC driver from the Microsoft website, you will get two jar files: sqljdbc4.jar and sqljdbc.jar.
For JDK5 – use sqljdbc.jar
for JDK6 – use sqljdbc4.jar

When you JDK1.5 and trying to load sqljdbc4.jar, you might get the below exception.So use sqljdbc.jar[2008]
Exceptionjava.lang.ClassNotFoundException: com.microsoft.sqlserver.jdbc.SQLServerDriver

他的意思是驱动版本低了,改换就可以了,
JDK5 – use sqljdbc.jar
JDK6 – use sqljdbc4.jar

你可能感兴趣的:(java)