为 SQL Server 设置 Maven 依赖项 [英] Setting up maven dependency for SQL Server

查看:40
本文介绍了为 SQL Server 设置 Maven 依赖项的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个 portlet,我可以在其中 Hibernate 访问 SQL Server 数据库.我为它设置了 ma​​ven 依赖项,并尝试以我知道 MySql 拥有它的相同方式找出 SQL Server 连接器.

I am developing a portlet where I have Hibernate access to SQL Server database. I set up maven dependencies for it and try to find out SQL Server connector on the same way I know MySql has it.

如果我搜索 SQL Server 连接器,我的 Google 搜索仍然只提供 Mysql.什么是正确的 ma​​ven 依赖 值?

Still my Google-search gives only Mysql if I search for SQL Server connector. What is the right maven dependency value?

推荐答案

从 Olaf 和 将其添加到您的本地 Maven 存储库 ;

Download the driver JAR from the link provided by Olaf and add it to your local Maven repository with;

mvn install:install-file -Dfile=sqljdbc4.jar -DgroupId=com.microsoft.sqlserver -DartifactId=sqljdbc4 -Dversion=4.0 -Dpackaging=jar

然后将其添加到您的项目中;

Then add it to your project with;

<dependency>
  <groupId>com.microsoft.sqlserver</groupId>
  <artifactId>sqljdbc4</artifactId>
  <version>4.0</version>
</dependency>

这篇关于为 SQL Server 设置 Maven 依赖项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆