Letter case error in Mysql

If anyone has run into a situation where sql queries from your java app were erroring out because of letter case in tables and column names in MySQL database, I have a quick solution for you.
First, what you should have done, but probably was too creative and used mixed case for creating table names/columns was,

to adopt a consistent convention, such as always creating and referring to databases and tables using lowercase names
as per this article: identifier-case-sensitivity

If going back and modifying code is too much, there is a quick fix for UNIX/Linux side. As the article above states, you need to set lower_case_table_names property to 1.
Simply create file /etc/my.cnf or if already created then only add the variable there thus:

[mysqld]
lower_case_table_names=1

Then restart the mysql service on the server.
As a result your java app will be able to query against MySQL tables and ignore letter case, the same way it does on Windows.

Leave a Comment