Monday, November 28, 2005

MySQL case sensitivity for table and column names

Quite basic tip, but I had a hard time making Tomcat work with a database that had a table created with a different case in another database. Unlike PostgreSQL and other databases, MySQL is case sensitive for table and column names on Linux/Unix, but case insensitive on Windows. If you have a datasource realm defined for a particular table, make sure the case for its name and its column names match how it was created in the database.

I found a "rule" for SQL naming suggested by Joe Celko: "keywords in ALL CAPS, table names in LeadingCaps, and column names in all_lowercase_with_underscores" (from an article in LinuxJournal).
Post a Comment