Setting up maven dependency for SQL Server

mico picture mico · Aug 4, 2011 · Viewed 145.7k times · Source

I am developing a portlet where I have Hibernate access to SQL Server database. I set up maven dependencies for it and try to find out SQL Server connector on the same way I know MySql has it.

Still my Google-search gives only Mysql if I search for SQL Server connector. What is the right maven dependency value?

Answer

Stu.C picture Stu.C · Aug 8, 2011

Download the driver JAR from the link provided by Olaf and add it to your local Maven repository with;

mvn install:install-file -Dfile=sqljdbc4.jar -DgroupId=com.microsoft.sqlserver -DartifactId=sqljdbc4 -Dversion=4.0 -Dpackaging=jar

Then add it to your project with;

<dependency>
  <groupId>com.microsoft.sqlserver</groupId>
  <artifactId>sqljdbc4</artifactId>
  <version>4.0</version>
</dependency>