While, in SQL, you can use double quotes to write identifiers in any case, DBMSes also have a "default" case that is used if the identifier isn't quoted. For example, PostgreSQL converts unquoted identifiers to lower case, while Snowflake converts them to upper case.
Does JDBC define a standard way of telling which it is for a particular DBMS?
CodePudding user response:
In theory the following methods from DatabaseMetaData
should give you that information:
storesUpperCaseIdentifiers()
storesUpperCaseQuotedIdentifiers()
storesLowerCaseIdentifiers()
storesLowerCaseQuotedIdentifiers()
storesMixedCaseIdentifiers()
storesMixedCaseQuotedIdentifiers()
But in my experience the information returned by the various drivers isn't 100% reliable.
The Postgres driver correctly reports storesLowerCaseIdentifiers = true
.
The MySQL driver does not check the server's configuration e.g. the various combinations of the file system's behaviour, lower_case_table_names
and innodb_file_per_table
.