Details
-
Bug
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Fixed
-
3.0.3
-
None
Description
There's a difference between 2.7.5 and 3.0.3 / 3.0.4-SNAPSHOT, which leads to the error "ClassCastException: class [B cannot be cast to class java.lang.String" in Liquibase (see https://github.com/liquibase/liquibase/issues/2431).
Connection.getMetaData().getColumns() returned in 2.7.5 a ResultSet, where the column type of "TYPE_NAME" was a java.lang.String. But 3.0.4 returns a org.mariadb.jdbc.MariaDbClob, which is then converted by Liquibase into a byte[] (See https://github.com/liquibase/liquibase/blob/79c0e38fe8987bdc7f4200cc05efa1b7c8276248/liquibase-core/src/main/java/liquibase/util/JdbcUtil.java#L89-L90) because MariaDbClob implements java.sql.Blob.
Is this an error on MariaDB side or is this something, that Liquibase would need to fix?
Please see the attached TestCase.java. If I run it with different version, I'll get the following results:
$ java --class-path=mariadb-java-client-2.7.5.jar TestCase.java
|
Metadata: class java.lang.String
|
VARCHAR col: class java.lang.String
|
|
$ java --class-path=mariadb-java-client-3.0.3.jar TestCase.java
|
Metadata: class org.mariadb.jdbc.MariaDbClob
|
VARCHAR col: class java.lang.String
|
|
$ java --class-path=mariadb-java-client-3.0.4-SNAPSHOT.jar TestCase.java
|
Metadata: class org.mariadb.jdbc.MariaDbClob
|
VARCHAR col: class java.lang.String
|
Real queries seem to behave the correctly and return a String for VARCHAR columns.
This currently prevents Liquibase / Liquibase-Percona from Upgrading to MariaDB Connector 3.x (https://github.com/liquibase/liquibase-percona/pull/180).