The Microsoft SQL Server JDBC driver is not available in public repositories because of licensing issues but it is easy to install into a company wide repository like Sonatype Nexus or into the local repository on your machine. This procedure can be used for other libraries as well.

Step 1 : Download the driver from http://www.microsoft.com/download/en/details.aspx?displaylang=en&id=11774

Step 2: Extract the file and locate the sqljdbc.jar and sqljdbc4.jar. The table below indicates the usage of the jars respectively.

JAR

Description

sqljdbc.jar sqljdbc.jar class library provides support for JDBC 3.0.sqljdbc.jar class library requires a Java Runtime Environment (JRE) of version 5.0. Using sqljdbc.jar on JRE 6.0 will throw an exception when connecting to a database.The JDBC Driver does not support JRE 1.4. You must upgrade JRE 1.4 to either JRE 5.0 or JRE 6.0 when using the JDBC Driver. In some cases, you might need to recompile your application because it might not be compatible with JDK 5.0 or later. For more information, see the documentation on Sun Microsystems Web site.
sqljdbc4.jar sqljdbc4.jar class library provides support for JDBC 4.0. It includes all of the features of the sqljdbc.jar as well as the new JDBC 4.0 methods.sqljdbc4.jar class library requires a Java Runtime Environment (JRE) of version 6.0. Using sqljdbc4.jar on JRE 1.4 or 5.0 will throw an exception.Use sqljdbc4.jar when your application must run on JRE 6.0, even if your application does not use JDBC 4.0 features.

Step 3: If you have Nexus then use the following pom.xml to add the sqljdbc.jar

<?xml version="1.0" encoding="UTF-8"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
         xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

    <modelVersion>4.0.0</modelVersion>
    <groupId>com.microsoft.sqlserver</groupId>
    <artifactId>sqljdbc</artifactId>
    <version>4.0.2206.100</version>
</project>

Step 4: Select the 3rd Party Releases repository in Nexus. In the image I am showing my local Nexus 2.0 repository

3rd party repository

Step 5: Click the Artifact Upload tab.

a. Select the GAV Definition: From POM

b. POM file name: Select the file containing the pom.xml from step 3

c. Select artifacts to upload: Select the sqljdbc.jar from enu folder in the extracted zip folder

Adding sqljdbc.jar to Nexus 3rd Party Releases

Step 6: Select Upload

Uploaded

Step 7: Installing the sqljdbc4.jar uses the following pom.xml and the steps outlined above

<?xml version="1.0" encoding="UTF-8"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
         xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

    <modelVersion>4.0.0</modelVersion>
    <groupId>com.microsoft.sqlserver</groupId>
    <artifactId>sqljdbc4</artifactId>
    <version>4.0.2206.100</version>
</project>

Step 8: If you do not have Sonatype Nexus, then to install the libraries into the local repository using the following command. You do not need the pom.xml files since these will be created by Maven.

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

Step 9: Reference the library in you project

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

NOTE: Tomorrow I will be deploying the driver into Apache Karaf.