×
×

Knowledgebase & Downloads

The knowledgebase provides documentation written by our team. Please select a category or search for answers.

Articles

MySQL case sensitivity in Linux and Windows

Q: I am getting Table 'logitix_gps2.user' doesn't exist
org.hibernate.exception.SQLGrammarException: could not execute query

A: First check if the table exists and if its name is excatly the same as the one in error message.

The problem usually arises when you are not strict about case in your table names (when developing on Windows) and then you upload your database to a Linux server.

We are unable to correct this for you. The MySQL case-sensitivity setting is global for all databases on a database server so it cannot be set per database.

From developer point of view where portability is important the hints from
http://dev.mysql.com/doc/refman/5.1/en/identifier-case-sensitivity.html
should be followed:

"Use lower_case_table_names=0 on Unix and lower_case_table_names=2 on Windows. This preserves the lettercase of database and table names. The disadvantage of this is that you must ensure that your statements always refer to your database and table names with the correct lettercase on Windows. If you transfer your statements to Unix, where lettercase is significant, they do not work if the lettercase is incorrect."

So the rule for developer should be: USE THE SAME CASE IN CODE AS YOU USE IN DDL

Example:

In code: SELECT * FROM SuperUser
In DDL: CREATE TABLE `SuperUser` ...

In code: insert into EMPLOYEE Vvalues (...)
In DDL: CREATE TABLE `EMPLOYEE` ...

In code: update employee set ...
In DDL: CREATE TABLE `employee` ...


Powered by HostBill