March 23, 2014

Add Microsoft SQL JDBC driver to Maven


1. Download the JDBC driver for Microsoft SQL Server
Visit the MSDN site for SQL Server and download the latest version of the JDBC driver for your operating system.
2. Unzip the package
3. Open a command prompt and switch into the expanded directory where the jar file is located.
4. Execute the following command. Be sure to modify the jar file name and version as necessary:

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

5. Modify your POM
Include the new dependency by modifying your project’s pom.xml. Add the following dependency:

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

No comments: