Reputation: 43
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.
Upvotes: 4
Views: 17490
Reputation: 41
My observation using MySql Connector jdbc driver(8.0.17) with Mariadb(10.6.10) on Linux. The microsecond precision in case of datetime(6) columns is not stored correctly. It just ignores the millisecond, microsecond precision. However replacing the MySQL connector jdbc driver with MariaDB connector j(3.1.0) correctly stores the milliseconds and microseconds precision.
Upvotes: 1
Reputation: 2305
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.
Upvotes: 4