0

I'm using Spring-jdbc NamedParameterJdbcTemplate with mysql-connector-j and I'm getting tons of "extra" SQL issued after almost every statement all of which looks like "SHOW FULL COLUMNS FROM ...".

Here's a piece of MySQL log that shows my query followed by lots of queries that I did not issue:

Query     SELECT p.*, t.textdata descr, ... from parts p, string t where .....
Query     SHOW FULL COLUMNS FROM `mydb`.`parts`
Query     SHOW FULL COLUMNS FROM `mydb`.`parts`
Query     SHOW FULL COLUMNS FROM `mydb`.`parts`
Query     SHOW FULL COLUMNS FROM `mydb`.`parts`
Query     SHOW FULL COLUMNS FROM `mydb`.`parts`
Query     SHOW FULL COLUMNS FROM `mydb`.`parts`
Query     SHOW FULL COLUMNS FROM `mydb`.`parts`
Query     SHOW FULL COLUMNS FROM `mydb`.`parts`
Query     SHOW FULL COLUMNS FROM `mydb`.`parts`
Query     SHOW FULL COLUMNS FROM `mydb`.`parts`
Query     SHOW FULL COLUMNS FROM `mydb`.`parts`
Query     SHOW FULL COLUMNS FROM `mydb`.`parts`
Query     SHOW FULL COLUMNS FROM `mydb`.`parts`
Query     SHOW FULL COLUMNS FROM `mydb`.`parts`
Query     SHOW FULL COLUMNS FROM `mydb`.`parts`
Query     SHOW FULL COLUMNS FROM `mydb`.`strings`
Query     SHOW FULL COLUMNS FROM `mydb`.`strings`

Why is this happening and how do I stop it?

1 Answer 1

1

After some investigation it seems the issue is caused by poor implementation of Field.getCollation() in mysql-connector which is called from ResultSetMetaData.isCaseSensitive() which in turn is called by CachedRowSet which is used by Spring jdbc.

Fortunately there is a quick workaround which is to set useDynamicCharsetInfo to false e.g.:

jdbc:mysql://localhost/mydb?useDynamicCharsetInfo=false

=== EDIT Dec 2015 ===

After abandoning the GPL-licensed MySQL-connector in favor of LGPL-licensed MariaDB-connector, this problem no longer exists.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.