mysql connector 6.0.2: "Column name pattern can not be NULL or empty"
Description
Environment
Windows 10, Java 1.8.0_77, 64-bit
Activity

Andrus Adamchik April 9, 2018 at 2:41 PM
I just ran into this issue with Liquibase under Bootique. Once we upgraded Liquibase in Bootique to 3.6.0 from 3.5.3 the issue went away. So I guess it can be closed here.

Vladislav Sidorovich May 18, 2017 at 1:00 PMEdited
In my case it was solved by adding
to the mysql connection string
Hendy Irawan November 23, 2016 at 12:18 PMEdited
Still happens with liquibase 3.5.3.
Note that:
> [30 Sep 18:37] Daniel So
> Posted by developer:
> The change of the default value for nullNamePatternMatchesAll (and for nullCatalogMeansCurrent too) has now been noted in the manual (https://dev.mysql.com/doc/connector-j/6.0/en/connector-j-properties-changed.html).
> The changes will be visible in the manual's next build.
So this needs to be fixed by Liquibase (for both MySQL driver version ranges).

Michael Hixson April 16, 2016 at 12:40 AM
I filed an issue on the MySQL bug tracker related to this: http://bugs.mysql.com/bug.php?id=81105
I use liquibase and mysql-connector-java in my application, and I tried upgrading the mysql connector from 5.1.38 to 6.0.2. After the upgrade, liquibase throws an error when I try to run the migrations.
I'm calling the
liquibase.Liquibase.update(String)
method, and there's a long exception related to this line:https://github.com/liquibase/liquibase/blob/liquibase-parent-3.4.2/liquibase-core/src/main/java/liquibase/snapshot/JdbcDatabaseSnapshot.java#L277
Here's the root cause of the stack trace:
The final parameter on that line is the
columnNamePattern
, and it isnull
. It turns out that thenullNamePatternMatchesAll
connection property changed its default value between versions 5.1 and 6.0 of the connector. The default istrue
in 5.1,false
in 6.0.https://dev.mysql.com/doc/connector-j/5.1/en/connector-j-reference-configuration-properties.html
https://dev.mysql.com/doc/connector-j/6.0/en/connector-j-reference-configuration-properties.html
Workaround for me: I can set
nullNamePatternMatchesAll=true
in my connection properties. That makes the error go away.Possible fix: Change liquibase to pass in
"%"
instead ofnull
wherever it's currently usingnull
to mean "all" (which assumes thatnullNamePatternMatchesAll=true
). The method I linked to is one. I have a feeling there are more.