Java 用于连接到 MS SQL 服务器的 jar

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/2475991/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-13 08:11:58  来源:igfitidea点击:

Which jar to use for connecting to MS SQL server

javasqlsql-serverjdbcmssql-jdbc

提问by Amit

Can some one please guide me to understand which jar file i need to include in my application to be able to set up a jdbc connection with ms sql server.

有人可以指导我了解我需要在我的应用程序中包含哪个 jar 文件才能与 ms sql server 建立 jdbc 连接。

thanks in advance.

提前致谢。

采纳答案by kevchadders

sqljdbc.jar and sqljdbc4.jar class library files to be used depending on your preferred Java Runtime Environment (JRE) settings. For more information about which JAR file to choose, see System Requirementsfor the JDBC Driver.

sqljdbc.jar 和 sqljdbc4.jar 类库文件取决于您的首选 Java 运行时环境 (JRE) 设置。有关选择哪个 JAR 文件的更多信息,请参阅JDBC 驱动程序的系统要求

Downloads links and more information can be found here.

可以在此处找到下载链接和更多信息。

回答by saugata

You can use jtdsjar, you will also need to add the dll/so to you java library path.

您可以使用jtdsjar,您还需要将 dll/so 添加到您的 java 库路径。

EDIT:More recent release

编辑:最近的版本

回答by Narayan

The Microsoft SQL Server JDBC Driver version 2.0 provides sqljdbc.jarand sqljdbc4.jarclass library files to be used depending on your preferred Java Runtime Environment (JRE) settings.

Microsoft SQL Server JDBC Driver 2.0 版提供了sqljdbc.jarsqljdbc4.jar类库文件,根据您首选的 Java 运行时环境 (JRE) 设置使用。

sqljdbc4.jarclass library requires a Java Runtime Environment(JRE) of version 6.0 or later.

sqljdbc4.jar类库需要6.0 或更高版本的Java 运行时环境( JRE)。

回答by Alan MacK

Microsoft started publishing their Driver JARs to the central Maven repo in 2017. See Maven Searchfor the available versions.

Microsoft 于 2017 年开始将其驱动程序 JAR 发布到中央 Maven 存储库。请参阅Maven 搜索以了解可用版本。

<dependency>
    <groupId>com.microsoft.sqlserver</groupId>
    <artifactId>mssql-jdbc</artifactId>
    <version>7.0.0.jre10</version>
</dependency>