Recently, in a data synchronization project, I joined spring + JDBC development mode (IDE: STS) and began to use Maven to manage the project. Currently, a problem occurs when you add a local repository and add the sqljdbc4.jar driver package used to connect to sqlserver. I have not found this jar in many Maven repositories. I can only manually download it and add it to the local repository. I found that this package was not successfully added. I found the solution here: http://clde.betancourt.us/add-microsoft-sql-jdbc-driver-to-maven /.
The main steps are as follows:
1. Download sqljdbc4.jar locally
2. decompress the package to the local folder and find the sqljdbc4.jar path.
3. Open the command window and execute the following statement (prerequisite: configure the maven environment variable first)
1 C: \ Users \ nbxyz> MVN install: Install-file-dfile = E: \ sqljdbc4.jar-dgroupid = com. Microsoft. sqlserver-dartifactid = sqljdbc4-dversion = 4.0-dpackaging = jar
4. "build success" indicates that it is successfully added.
The generated pom file is as follows:
1 <? XML version = "1.0" encoding = "UTF-8" ?>
2 < 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"
3 Xmlns: xsi = "Http://www.w3.org/2001/XMLSchema-instance" >
4 < Modelversion > 4.0.0 </ Modelversion >
5 < Groupid > Com. Microsoft. sqlserver </ Groupid >
6 < Artifactid > Sqljdbc4 </ Artifactid >
7 < Version > 4.0 </ Version >
8 < Description > POM was created from install: Install-File </ Description >
9 </ Project >