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

本文介绍了解决使用旧版JDBC驱动连接SQL Server 2008时出现的版本不匹配错误的方法。建议使用正确的JDBC驱动版本,并确保没有旧版驱动存在于类路径中。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

问题描述
Java代码 复制代码 收藏代码
  1. com.microsoft.sqlserver.jdbc.SQLServerException: The server version is not supported. The target server must be SQL Server 2000 or later.
  2. at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDriverError(Unknown Source)
  3. at com.microsoft.sqlserver.jdbc.DBComms.Prelogin(Unknown Source)
  4. at com.microsoft.sqlserver.jdbc.DBComms.<init>(Unknown Source)
  5. at com.microsoft.sqlserver.jdbc.SQLServerConnection.connectHelper(Unknown Source)
  6. at com.microsoft.sqlserver.jdbc.SQLServerConnection.loginWithoutFailover(Unknown Source)
  7. at com.microsoft.sqlserver.jdbc.SQLServerConnection.connect(Unknown Source)
  8. at com.microsoft.sqlserver.jdbc.SQLServerDriver.connect(Unknown Source)
  9. at java.sql.DriverManager.getConnection(DriverManager.java:582)
  10. at java.sql.DriverManager.getConnection(DriverManager.java:185)
  11. at com.zuxia.util.DBUtil.getConn(DBUtil.java:40)
  12. at com.zuxia.dao.GoodsTypeDao.getAllGoodType(GoodsTypeDao.java:25)
  13. at org.apache.jsp.index_jsp._jspService(index_jsp.java:186)
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/
Java代码 复制代码 收藏代码
  1. 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.
  2. When you download the SQlserver 2008 JDBC driver from the Microsoft website, you will get two jar files: sqljdbc4.jar and sqljdbc.jar.
  3. For JDK5 – use sqljdbc.jar
  4. for JDK6 – use sqljdbc4.jar
  5. When you JDK1.5 and trying to load sqljdbc4.jar, you might get the below exception.So use sqljdbc.jar[2008]
  6. Exceptionjava.lang.ClassNotFoundException: com.microsoft.sqlserver.jdbc.SQLServerDriver
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 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值