Java系列:Add Microsoft SQL JDBC driver to Maven
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
- Visit the MSDN site for SQL Server and download the latest version of the JDBC driver for your operating system.
- Unzip the package
- Open a command prompt and switch into the expanded directory where the
jar
file is located. - Execute the following command. Be sure to modify the
jar
file name and version as necessary: - You should see something similar to this:
1
|
mvn install : install - file -Dfile=sqljdbc4.jar -Dpackaging=jar -DgroupId=com.microsoft.sqlserver -DartifactId=sqljdbc4 -Dversion=4.0 |
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的更多相关文章
- Add Microsoft SQL JDBC driver to Maven(转)
from:http://claude.betancourt.us/add-microsoft-sql-jdbc-driver-to-maven/ Add Microsoft SQL JDBC driv ...
- 添加Microsoft SQL JDBC driver 到 Maven
主要步骤如下: 1. 本地下载sqljdbc4.jar 2. 解压到本地文件夹中,并找到sqljdbc4.jar路径 3. 打开命令窗口,打开至工程目录,执行以下语句(前提:先配置好maven环境变量 ...
- java中myeclipse连接mysql问题(java.lang.ClassNotFoundException: com.mysql.jdbc.Driver)
java中myeclipse连接mysql问题(java.lang.ClassNotFoundException: com.mysql.jdbc.Driver) 1.往项目中添加mysql-conne ...
- 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 ...
- java.lang.ClassNotFoundException: com.mysql.jdbc.Driver解决方式
昨天整理桌面的时候将桌面的一堆文件移动到F盘去了,结果导致原来建的一些项目名称所有出现红色感叹号,打开一看,原来是由于我把hibernate的那些jar包移走了.导致user library里那些ja ...
- 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 ...
- 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 ...
- java.lang.ClassNotFoundException: com.mysql.jdbc.Driver问题
java.lang.ClassNotFoundException: com.mysql.jdbc.Driverat org.apache.catalina.loader.WebappClassLoad ...
- Idea运行web项目时,提示java.lang.ClassNotFoundException: com.mysql.jdbc.Driver解决方法
今天用 idea写了个工程.结果最后报错,错误信息如下: java.lang.ClassNotFoundException: com.mysql.jdbc.Driverat org.apache.ca ...
随机推荐
- 关于Socket建立长连接遇到的bug信息
下面是本人在Socket连接的开发中遇到的bug总结 1."远程服务器关闭了Socket长连接'的错误信息 2.关于"kCFStreamNetworkServiceTypeVoIP ...
- javascript的模块化解读
AMD是RequireJS在推广过程中对模块定义的规范化产出. 异步加载模块,依赖前置,提前执行. Define定义模块 define(['require','foo'],function(){ret ...
- 【转】Python开发指南:最佳实践精选
总体原则 价值 “为别人开发你也想要使用的工具.” ——Kenneth Reitz "简洁总是胜过可用." ——Pieter Hintjens "满足90%的使用场景.忽 ...
- Js中获取对象的所有key值
假如现在有一个对象 var obj = { A:2 ,B:"Ray" ,C:true ,D:function(){} } 如果想遍历对象obj中的所有键值,一般是用以下方式 for ...
- 正确使用 Volatile 变量——Brian Goetz
本文转自:http://www.ibm.com/developerworks/cn/java/j-jtp06197.html 由Java并发大师Brian Goetz所撰写的. Java 语言中的 v ...
- [转][原]openstack-kilo--issue(六)kilo版openstack的dashboard在session超时后重新登录报错解决办法
http://blog.csdn.net/wylfengyujiancheng/article/details/50523373?locationNum=1&fps=1 1.现象描述: kil ...
- 烂泥:KVM虚拟机windows系统增加硬盘
本文由秀依林枫提供友情赞助,首发于烂泥行天下. 前一篇文章介绍了有关linux系统添加硬盘的方法,这次我们来介绍有关windows系统添加的相关步骤. 其实linux和windows添加的硬盘的方法都 ...
- 计算机信息统计.vbs
temp=0 set wshshell=wscript.createobject("wscript.shell") Set WshNetwork = WScript.Createo ...
- 百度地图Api进阶教程-点击生成和拖动标注4.html
<!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content ...
- Linux学习之五——压缩与备份
一.Linux下常见的压缩文件 *.Z compress 程序压缩的档案(现在不流行了,用gzip也能解压): *.gz gzip 程序压缩的档案: *.bz2 bzip2 程序压缩的档案: *.ta ...