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?

我怕爱的太早我们不能终老 提交于 2020-12-30 04:58:45

问题


I am preparing to use jdbc for the first time and am in the process of installing the jdbc driver for MySQL.

However, it is unclear to me which of these files to move to the WEB_INF/lib folder in Eclipse. They both seem to contain the same content and are included together in the downloaded zip file for the MySQL connector.

I have searched everywhere but have been unable to find any documentation to explain which of these files to use.


回答1:


I thought you were joking, but I just downloaded the zip from https://dev.mysql.com/downloads/connector/j/ and, indeed, it contains both.

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). I have unzipped both and compared them using kdiff3.

In short: you can use either: whatever you prefer.

This change is mentioned in CHANGES as:

- Fix for Bug#27231383, PROVIDE MAVEN-FRIENDLY COMMERCIAL PACKAGES WITHOUT "-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.

In addition, the online Connector/J 5.1.46 release notes mentions:

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). 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. (Bug #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).

But to repeat: they are the same, and you can use either one.



来源:https://stackoverflow.com/questions/49387428/which-mysql-connector-do-i-use-mysql-connector-java-5-1-46-jar-or-mysql-connect

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!