IndianWebPortal.com

Something Different In Linux

Home » mysql » Letter case error in Mysql

Letter case error in Mysql

Posted by Rishikesh Vispute Categories: 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.


Popular Posts

remove index.php fro

How to remove index.php from url in magento Ans : If you ...

PHP-Java bridge on p

  What is php-java bridge? The php-java bridge is the php ...

Set expiration for y

If you want to set the expiration to your site ...

Warning: Parameter 1

Error: Warning: Parameter 1 to modMainMenuHelper::buildXML() expected to be a ...

domain pointing to e

If you domain uses external MX record and it is ...