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.

Gord Thompson
  • 116,920
  • 32
  • 215
  • 418
Amit
  • 716
  • 3
  • 8
  • 16

5 Answers5

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.

Gord Thompson
  • 116,920
  • 32
  • 215
  • 418
kevchadders
  • 8,335
  • 4
  • 42
  • 61
6

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

EDIT: More recent release

saugata
  • 2,823
  • 1
  • 27
  • 39
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.

Narayan
  • 6,031
  • 3
  • 41
  • 45
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>
Alan MacK
  • 1,366
  • 1
  • 9
  • 8
0

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

MS JDBC Driver. Has documentation.

TomTom
  • 61,059
  • 10
  • 88
  • 148
  • That version of the JDBC driver is very old (released over 9 years ago). Look [here](https://learn.microsoft.com/en-us/sql/connect/jdbc/microsoft-jdbc-driver-for-sql-server) for more current information. – Gord Thompson Jul 13 '18 at 13:21
  • You make it sounds like giving a current answer more than 8 years ago (!) was bad. – TomTom Jul 13 '18 at 13:37
  • 1
    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. – Gord Thompson Jul 13 '18 at 13:50