Maven does not directly support some libraries, like Microsoft’s SQL Server JDBC. This tutorial will show you how to add an external dependency to your local Maven repository. It assumes you have already installed Maven.

Download the JDBC driver for Microsoft SQL Server

  1. 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:
  5. 1
    mvn install:install-file -Dfile=sqljdbc4.jar -Dpackaging=jar -DgroupId=com.microsoft.sqlserver -DartifactId=sqljdbc4 -Dversion=4.0
  6. You should see something similar to this:
  7. 1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    [INFO] Scanning for projects...
    [INFO]
    [INFO] ------------------------------------------------------------------------
    [INFO] Building Maven Stub Project (No POM) 1
    [INFO] ------------------------------------------------------------------------
    [INFO]
    [INFO] --- maven-install-plugin:2.3.1:install-file (default-cli) @ standalone-pom ---
    [INFO] Installing /Users/claude/installers/JDBC/sqljdbc_4.0/enu/sqljdbc4.jar to /Users/claude/.m2/repository/com/microsoft/sqlserver/sqljdbc4/4.0/sqljdbc4-4.0.jar
    [INFO] Installing /var/folders/c6/q1bdtq557kv54783p1g6cbsw0000gp/T/mvninstall1874482299687761721.pom to /Users/claude/.m2/repository/com/microsoft/sqlserver/sqljdbc4/4.0/sqljdbc4-4.0.pom
    [INFO] ------------------------------------------------------------------------
    [INFO] BUILD SUCCESS
    [INFO] ------------------------------------------------------------------------
    [INFO] Total time: 1.208s
    [INFO] Finished at: Tue Mar 13 14:07:31 EDT 2012
    [INFO] Final Memory: 3M/81M
    [INFO] ------------------------------------------------------------------------

    Modify your POM

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

    1
    2
    3
    4
    5
    <dependency>
        <groupId>com.microsoft.sqlserver</groupId>
        <artifactId>sqljdbc4</artifactId>
        <version>4.0</version>
    </dependency>

    Save the pom.xml file and build the project to make sure no errors exist.

    http://claude.betancourt.us/add-microsoft-sql-jdbc-driver-to-maven/

Java系列:Add Microsoft SQL JDBC driver to Maven的更多相关文章

  1. Add Microsoft SQL JDBC driver to Maven(转)

    from:http://claude.betancourt.us/add-microsoft-sql-jdbc-driver-to-maven/ Add Microsoft SQL JDBC driv ...

  2. 添加Microsoft SQL JDBC driver 到 Maven

    主要步骤如下: 1. 本地下载sqljdbc4.jar 2. 解压到本地文件夹中,并找到sqljdbc4.jar路径 3. 打开命令窗口,打开至工程目录,执行以下语句(前提:先配置好maven环境变量 ...

  3. java中myeclipse连接mysql问题(java.lang.ClassNotFoundException: com.mysql.jdbc.Driver)

    java中myeclipse连接mysql问题(java.lang.ClassNotFoundException: com.mysql.jdbc.Driver) 1.往项目中添加mysql-conne ...

  4. Oozie时出现Exception in thread "main" java.lang.UnsupportedClassVersionError: com/mysql/jdbc/Driver : Unsupported major.minor version 52.0?

    不多说,直接上干货! 问题详情 [hadoop@bigdatamaster oozie--cdh5.5.4]$ bin/ooziedb.sh create -sqlfile oozie.sql -ru ...

  5. java.lang.ClassNotFoundException: com.mysql.jdbc.Driver解决方式

    昨天整理桌面的时候将桌面的一堆文件移动到F盘去了,结果导致原来建的一些项目名称所有出现红色感叹号,打开一看,原来是由于我把hibernate的那些jar包移走了.导致user library里那些ja ...

  6. java链接MySQL数据库时使用com.mysql.jdbc.Connection的包会出红线问题 java.lang.ClassNotFoundException: com.mysql.jdbc.Driver问题

    package com.swift; //这里导入的包是java.sql.Connection而不是com.mysql.jdbc.Connection import java.sql.Connecti ...

  7. Unofficial Microsoft SQL Server Driver for PHP (sqlsrv)非官方的PHP SQL Server 驱动

    原文 Unofficial Microsoft SQL Server Driver for PHP (sqlsrv) Here are unofficial modified builds of Mi ...

  8. java.lang.ClassNotFoundException: com.mysql.jdbc.Driver问题

    java.lang.ClassNotFoundException: com.mysql.jdbc.Driverat org.apache.catalina.loader.WebappClassLoad ...

  9. Idea运行web项目时,提示java.lang.ClassNotFoundException: com.mysql.jdbc.Driver解决方法

    今天用 idea写了个工程.结果最后报错,错误信息如下: java.lang.ClassNotFoundException: com.mysql.jdbc.Driverat org.apache.ca ...

随机推荐

  1. android 小记

    1.INSTALL_FAILED_INSUFFICIENT_STORAGE 手机内存不够,删除部分后即可安装.

  2. MongoDb的bin目录下文件mongod,mongo,mongostat命令的说明及使用

    MongoDB的下载地址:http://www.mongodb.org/downloads. 下载好直接解压安装包,即可使用. bin目录下的几个文件说明: mongo 客户端程序,连接MongoDB ...

  3. [QualityCenter]设置工作流脚本-新建缺陷时字段自动生成

    需求:新建缺陷时,自动生成缺陷状态.检查者和检查日期的值. 在脚本编辑器找到Defects_Bug_New函数,然后填写以下代码: Sub Defects_Bug_New    On Error Re ...

  4. 怎么录制Android或IOS动画教程

    前一篇文章介绍了用DemoCreator制作Android视频教程,今天再介绍一种方法. 那就是用GifCam软件录制,此软件录制导出成Gif动画图片,可直接放在你的文章里面,效果比flash要好. ...

  5. Effective Java 48 Avoid float and double if exact answers are required

    Reason The float and double types are particularly ill-suited for monetary calculations because it i ...

  6. Jquery Easy UI--datagrid的使用(转)

    第一篇学的是做一个管理的外框,接着就是数据datagrid绑定了,这里我用asp.net mvc3来做的,主要就是熟悉属性.方法. 打开easyui的demo 就可以看到如下一段代码: 和上篇一样cl ...

  7. JSON转换类(二)--List转换成Json、对象集合转换Json等

    #region List转换成Json /// <summary> /// List转换成Json /// </summary> public static string Li ...

  8. multiprocessing module in python(转)

    序.multiprocessing python中的多线程其实并不是真正的多线程,如果想要充分地使用多核CPU的资源,在python中大部分情况需要使用多进程.Python提供了非常好用的多进程包mu ...

  9. UESTC 898 方老师和缘分 --二分图匹配+强连通分量

    这题原来以为是某种匹配问题,后来好像说是强连通的问题. 做法:建图,每个方老师和它想要的缘分之间连一条有向边,然后,在给出的初始匹配中反向建边,即如果第i个方老师现在找到的是缘分u,则建边u-> ...

  10. xampp 用phpmyadmin在页面上修改密码后,无法登陆,密码没问题

    xampp 用phpmyadmin在页面上修改密码后,无法登陆,密码没问题一直提示密码错误, 什么原因? ------解决方案--------------------改了密码之后,phpmyadmin ...