博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Add Microsoft SQL JDBC driver to Maven(转)
阅读量:4960 次
发布时间:2019-06-12

本文共 2375 字,大约阅读时间需要 7 分钟。

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

Add Microsoft SQL JDBC driver to Maven

  • March 13, 2012
  • / /
 
 

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 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:
1
mvn
install
:
install
-
file
-Dfile=sqljdbc4.jar -Dpackaging=jar -DgroupId=com.microsoft.sqlserver -DartifactId=sqljdbc4 -Dversion=4.0
    1. You should see something similar to this:
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.

转载于:https://www.cnblogs.com/GarfieldTom/p/3698992.html

你可能感兴趣的文章
如何用WordPress做网站?
查看>>
Linux下gcc,g++,gdb,scon部分用法笔记
查看>>
Spring boot 1: 使用IDEA创建Spring boot项目
查看>>
经典SQL语句大全(转)
查看>>
多表查询
查看>>
assign和weak的深层次解析
查看>>
[string]字符串中几个比较难的算法和容易搞混的题目
查看>>
java integer String之equals vs ==
查看>>
调试maven源代码
查看>>
[转载]Java应用程序中的内存泄漏及内存管理
查看>>
算法体会以及常见机器学习算法公式
查看>>
css3属性之 box-sizing
查看>>
Essential reading: My top 10 books (zz)
查看>>
前端实现表格基于游览器固定显示
查看>>
Mac下安装 MongoDB
查看>>
2018秋季C语言学习总结
查看>>
node.js通俗理解
查看>>
IIS上部署WCF服务
查看>>
湖南集训day4
查看>>
轻松搞定数据验证(二)
查看>>