1.下载依赖
链接:https://pan.baidu.com/s/1Tz4Biv3rakJshRJTWWGwgA
提取码:z2g9
2.使用命令将依赖打包到本地maven仓库
打开cmd,输入命令:
mvn install:install-file -Dfile=sqljdbc42.jar -Dpackaging=jar -DgroupId=com.microsoft.sqlserver -DartifactId=sqljdbc4 -Dversion=4.2
命令解释:mvn install:install-file -Dfile="jar包的绝对路径" -Dpackaging="文件打包方式" -DgroupId=groupid名 -DartifactId=artifactId名 -Dversion=jar版本 (artifactId名对应之后maven配置的依赖名)。
3.pom文件添加依赖
<dependency>
<groupId>com.microsoft.sqlserver</groupId>
<artifactId>sqljdbc4</artifactId>
<version>4.2</version>
</dependency>
4.java项目配置文件配置
driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver
url: jdbc:sqlserver://localhost:1433;DatabaseName=u8cloudgis
username: test
password: 1