Add Microsoft SQL JDBC driver to Maven

Source: Internet
Author: User

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 >

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.