Java SQL Server 2014 的 JDBC 驱动程序
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/27604811/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
JDBC driver for SQL server 2014
提问by Nayan Sonthalia
We have recently migrated to SQL server 2014 with JAVA 5 on one machine and JAVA 6 on another (this is a requirement). When I try to connect to database I get follwoing exception.
我们最近迁移到 SQL server 2014,一台机器上有 JAVA 5,另一台机器上有 JAVA 6(这是必需的)。当我尝试连接到数据库时,出现以下异常。
org.jboss.resource.JBossResourceException: Could not create connection; - nested throwable: (
com.microsoft.sqlserver.jdbc.SQLServerException:
The server version is not supported.
The target server must be SQL Server 2000 or later.
)
at org.jboss.resource.adapter.jdbc.local.LocalManagedConnectionFactory.createManagedConnection(LocalManagedConnectionFactory.java:168)
at org.jboss.resource.connectionmanager.InternalManagedConnectionPool.createConnectionEventListener(InternalManagedConnectionPool.java:508)
at org.jboss.resource.connectionmanager.InternalManagedConnectionPool.getConnection(InternalManagedConnectionPool.java:207)
Following is the configuration:
以下是配置:
- OS: Windows server 2012
- SQL server 2014
- JAVA version: JDK5u11 and JDK6u24
- Jar file: sqljdbc.jar for JDK5 and sqljdbc4.jar for JDK6
- 操作系统:Windows Server 2012
- SQL 服务器 2014
- JAVA 版本:JDK5u11 和 JDK6u24
- Jar 文件:用于 JDK5 的 sqljdbc.jar 和用于 JDK6 的 sqljdbc4.jar
采纳答案by Gord Thompson
You will need to upgrade your SQL Server JDBC driver to at least version 4.0 (download here). Then you can use its versions of
您需要将 SQL Server JDBC 驱动程序升级到至少 4.0 版(在此处下载)。然后你可以使用它的版本
- sqljdbc.jar for Java 5, and
- sqljdbc4.jar for Java 6
- 用于 Java 5 的 sqljdbc.jar,以及
- 用于 Java 6 的 sqljdbc4.jar
to access SQL Server 2014.
访问 SQL Server 2014。
回答by Nayan Sonthalia
We discarded the sqljdnc4.jar
and used jtds jar
instead and everything works like a charm.
我们丢弃了sqljdnc4.jar
并使用了jtds jar
,一切都像魅力一样。