MySQL 的 Connector/J 可以与 MariaDB 一起使用吗?

我正在尝试使用 此处,但这无法正常工作并且 MariaDB 会记录 `

I'm attempting to connect to my MariaDB database using Connector/J from here, but this fails to work and MariaDB logs `

"[警告] 与 db 的连接 12 中止:'enwikt_parsed' 用户:'javawiki' 主机:'localhost'(读取通信时出错数据包)".

"[Warning] Aborted connection 12 to db: 'enwikt_parsed' user: 'javawiki' host: 'localhost' (Got an error reading communication packets)".

`

我突然想到,我只是假设 MySQL 中的 Connector/J 可以与 MariaDB 一起使用,但现在我不太确定.我知道 MariaDB 有自己的 Java API/连接器,但我正在使用其他人的代码来 parse wiktionary,因此无法使用.

It occurs to me that I just assumed Connector/J from MySQL would just work with MariaDB, but now I'm not so sure. I know MariaDB has their own Java API/Connector, but I'm using someone else's code to parse wiktionary, and therefore can't use it.

在我尝试一些更复杂的解决方案之前,我想知道我是否正在尝试修复一些原本不打算以这种方式使用的东西.

Before I try some more involved solutions, I'd like to know if I'm trying to fix something that wasn't meant to be used this way in the first place.

推荐答案

是的,MySQL 的 Connector/J 兼容 MariaDB.您需要检查版本.

Yes, MySQL's Connector/J is compatible with MariaDB. You need to check version though.

出于所有实际目的,MariaDB 是替代相同的 MySQL 版本(例如 MySQL 5.1 -> MariaDB 5.1、MariaDB5.2 &MariaDB 5.3 是兼容的.MySQL 5.5 与 MariaDB 5.5 兼容,在实践中也与 MariaDB 10.0 兼容,MySQL 5.6 与 MariaDB 10.0 兼容,MySQL 5.7 与 MariaDB 10.2 兼容)

For all practical purposes, MariaDB is a binary drop in replacement of the same MySQL version (for example MySQL 5.1 -> MariaDB 5.1, MariaDB 5.2 & MariaDB 5.3 are compatible. MySQL 5.5 is compatible with MariaDB 5.5 and also in practice with MariaDB 10.0, MySQL 5.6 is compatible with MariaDB 10.0 and MySQL 5.7 is compatible with MariaDB 10.2)

参考:https://mariadb.com/kb/en/library/mariadb-vs-mysql-compatibility/

所有 MySQL 连接器(PHP、Perl、Python、Java、.NET、MyODBC、Ruby、MySQL C 连接器等)在 MariaDB 中的工作不变.

All MySQL connectors (PHP, Perl, Python, Java, .NET, MyODBC, Ruby, MySQL C connector etc) works unchanged with MariaDB.

相关文章