简体   繁体   English

我使用哪个MySQL连接器:mysql-connector-java-5.1.46.jar或mysql-connector-java-5.1.46-bin.jar有什么区别?

[英]Which MySQL connector do I use: mysql-connector-java-5.1.46.jar or mysql-connector-java-5.1.46-bin.jar What is the difference?

I am preparing to use jdbc for the first time and am in the process of installing the jdbc driver for MySQL. 我准备第一次使用jdbc,我正在安装MySQL的jdbc驱动程序。

However, it is unclear to me which of these files to move to the WEB_INF/lib folder in Eclipse. 但是,我不清楚哪些文件移动到Eclipse中的WEB_INF / lib文件夹。 They both seem to contain the same content and are included together in the downloaded zip file for the MySQL connector. 它们似乎都包含相同的内容,并且包含在MySQL连接器的下载zip文件中。

I have searched everywhere but have been unable to find any documentation to explain which of these files to use. 我已经到处搜索,但一直无法找到任何文档来解释使用哪些文件。

I thought you were joking, but I just downloaded the zip from https://dev.mysql.com/downloads/connector/j/ and, indeed, it contains both. 我以为你是在开玩笑,但我刚从https://dev.mysql.com/downloads/connector/j/下载了zip,实际上它包含两者。

The mysql-connector-java-5.1.46.jar and mysql-connector-java-5.1.46-bin.jar are binary identical, except for the META-INF/INDEX.LIST (which contains the actual jar filename). 除了META-INF/INDEX.LIST (包含实际的jar文件名)之外, mysql-connector-java-5.1.46.jarmysql-connector-java-5.1.46-bin.jar是二进制相同的。 I have unzipped both and compared them using kdiff3. 我解压缩了两个并使用kdiff3比较它们。

In short: you can use either: whatever you prefer. 简而言之:您可以使用任何一种:无论您喜欢什么。

This change is mentioned in CHANGES as: 此更改在CHANGES提及为:

- Fix for Bug#27231383, PROVIDE MAVEN-FRIENDLY COMMERCIAL PACKAGES WITHOUT "-BIN". - 修复Bug#27231383,提供没有“-BIN”的商业友好商品包。

Interestingly, there is no bug 27231383 in the MySQL bug tracker (the number is too high for the 'normal' bugs listed), so maybe it is from another system within Oracle. 有趣的是,MySQL错误跟踪器中没有错误27231383(该数字对于列出的“正常”错误来说太高了),所以它可能来自Oracle内的另一个系统。

In addition, the online Connector/J 5.1.46 release notes mentions: 此外, 在线Connector / J 5.1.46发行说明中提到:

The bundle for Connector/J 5.1 delivered by Oracle now contains an additional jar package with the name mysql-connector-java-5.1.ver.jar ( mysql-connector-java-commercial-5.1.ver.jar for commercial bundles). 由Oracle提供的Connector / J 5.1包现在包含一个名为mysql-connector-java-5.1.ver.jar的附加jar包(商业包的mysql-connector-java-commercial-5.1.ver.jar )。 It is identical with the other jar package with the original package named mysql-connector-java-5.1.ver-bin.jar ( mysql-connector-java-commercial-5.1.ver-bin.jar for commercial bundles), except for its more Maven-friendly file name. 它与其他jar包相同,原始包名为mysql-connector-java-5.1.ver-bin.jar (商业包的mysql-connector-java-commercial-5.1.ver-bin.jar ),除了它更多Maven友好的文件名。 (Bug #27231383) (缺陷#27231383)

Presumably, given the closer match to Maven naming conventions, this makes it easier to install the library in local/company Maven repositories (eg if you don't want, or legally can't, use Maven Central). 据推测,鉴于与Maven命名约定的匹配程度越来越接近,这使得在本地/公司Maven存储库中安装库变得更加容易(例如,如果您不希望或在法律上不能使用Maven Central)。

But to repeat: they are the same, and you can use either one. 但重复一遍:它们是相同的,你可以使用其中任何一个。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM