Which jar to use for connecting to MS SQL server
Asked Answered
S

5

14

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.

thanks in advance.

Suspicious answered 19/3, 2010 at 8:54 Comment(0)
G
12

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 Requirements for the JDBC Driver.

Downloads links and more information can be found here.

Gleam answered 19/3, 2010 at 8:58 Comment(0)
C
6

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

EDIT: More recent release

Carrelli answered 19/3, 2010 at 8:59 Comment(2)
There are more recent versions on github: github.com/milesibastos/jTDS/releasesBathsheeb
@Abhishek - Microsoft's JDBC driver for SQL Server is now open source as well (MIT license).Tinsel
T
4

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

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

Trainband answered 19/3, 2010 at 9:2 Comment(0)
Q
3

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

<dependency>
    <groupId>com.microsoft.sqlserver</groupId>
    <artifactId>mssql-jdbc</artifactId>
    <version>7.0.0.jre10</version>
</dependency>
Quartile answered 15/11, 2018 at 20:5 Comment(0)
C
0

http://www.microsoft.com/downloads/details.aspx?FamilyID=99B21B65-E98F-4A61-B811-19912601FDC9&displaylang=en

MS JDBC Driver. Has documentation.

Coinstantaneous answered 19/3, 2010 at 8:58 Comment(3)
That version of the JDBC driver is very old (released over 9 years ago). Look here for more current information.Tinsel
You make it sounds like giving a current answer more than 8 years ago (!) was bad.Coinstantaneous
No, I was just giving future readers a heads-up that the link (which still works) takes them to a download page for an old version of the driver. A surprising number of mssql-jdbc questions are asked by people who are using an ancient version of the JDBC driver and don't even know it.Tinsel

© 2022 - 2025 — McMap. All rights reserved.