gpt4 book ai didi

java - com.microsoft.sqlserver.jdbc.SQLServerDriver 类未找到异常(新)

转载 作者:行者123 更新时间:2023-12-01 09:04:22 27 4
gpt4 key购买 nike

现在,当我尝试定义 class.forname 时,我正在使用 Microsoft SQLserver jdbc 连接

java.lang.ClassNotFoundException: com.microsoft.sqlserver.jdbc.SQLServerDriver

发生错误,其他一切都很好,但我对这个错误一无所知。

pom.xml:

<dependency>
<groupId>com.microsoft.sqlserver</groupId>
<artifactId>sqljdbc4</artifactId>
<version>4-2.0</version>
<scope>system</scope>
<systemPath>D:\my current work(please backup this folder)\backup\12-15-2016\milma_jishnu/src/main/lib/sqljdbc4-2.0.jar</systemPath>
</dependency>

最佳答案

引用Maven documentation :

System Dependencies

Important note: This is marked deprecated.

Dependencies with the scope system are always available and are not looked up in repository. They are usually used to tell Maven about dependencies which are provided by the JDK or the VM. Thus, system dependencies are especially useful for resolving dependencies on artifacts which are now provided by the JDK, but where available as separate downloads earlier. Typical example are the JDBC standard extensions or the Java Authentication and Authorization Service (JAAS).

所以,<scope>system</scope>告诉 Maven:这已经存在,你不需要做任何事情。

因此,它没有添加到类路径中,您想知道为什么它不存在?

您似乎误解了 <scope>system</scope> 的目的。不要使用它,因为 MS SQL JDBC 驱动程序不是 JDK 的一部分。

关于java - com.microsoft.sqlserver.jdbc.SQLServerDriver 类未找到异常(新),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41405978/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com