[CONJ-935] Connection.getMetaData() returns MariaDbClob instead of String Created: 2022-02-24 Updated: 2022-03-03 Resolved: 2022-03-03 |
|
| Status: | Closed |
| Project: | MariaDB Connector/J |
| Component/s: | metadata |
| Affects Version/s: | 3.0.3 |
| Fix Version/s: | 3.0.4 |
| Type: | Bug | Priority: | Major |
| Reporter: | Andreas Dangel | Assignee: | Diego Dupin |
| Resolution: | Fixed | Votes: | 1 |
| Labels: | None | ||
| Attachments: |
|
| 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:
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). |
| Comments |
| Comment by Diego Dupin [ 2022-03-02 ] |
|
javadoc about metadata.getColumn() expect return type :
So string type is expected here. This is a bug in driver |
| Comment by Andreas Dangel [ 2022-03-03 ] |
|
Hi diego dupin, thanks for working on this! I've run my integration test against the new driver 3.0.4-SNAPSHOT (built locally from branch develop) and there are no problems anymore. So my problem is solved. Regards, |
| Comment by Diego Dupin [ 2022-03-03 ] |
|
this is now corrected (test correction included with an additional task |