问题
I'm attempting to connect to my MariaDB database using Connector/J from here, but this fails to work and MariaDB logs `
"[Warning] Aborted connection 12 to db: 'enwikt_parsed' user: 'javawiki' host: 'localhost' (Got an error reading communication packets)".
`
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.
回答1:
Yes, MySQL's Connector/J is compatible with MariaDB. You need to check version though.
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)
Refer : https://mariadb.com/kb/en/library/mariadb-vs-mysql-compatibility/
All MySQL connectors (PHP, Perl, Python, Java, .NET, MyODBC, Ruby, MySQL C connector etc) works unchanged with MariaDB.
来源:https://stackoverflow.com/questions/57156119/does-mysqls-connector-j-work-with-mariadb