MySQLConnector Linux Weirdnesses

The MySQLConnector has some behaviour differences when we run certain applications against MySQL on a Windows box versus a Linux box. Consider the following lines (this example from our Database Migrator):

connection.getMetaData().getTables(null, null, "info", null);

This line is used to detect whether or not an “info” table has been created. Works just spiffily on Windows. Falls over bad on Linux.

If you look at the official JavaDoc for the java.sql.DatabaseMetaData class, it tells us that the first “null” parameter corresponds to the “catalog” (the standard Java name for the thing that MySQL calls “database name”):

“catalog – a catalog name; must match the catalog name as it is stored in the database; “” retrieves those without a catalog; null means that the catalog name should not be used to narrow the search”

According to this documentation, we should find an info table is one exists in any catalog. But using MySQL on Linux, it just doesn’t.

I have no solution. When I run into this situation, I just explicitly fill in the catalog. But that’s definitely an annoying work-around.

It's only fair to share...
Share on Facebook
Tweet about this on Twitter
Share on LinkedIn

Leave a Reply