UK Sales: 0800 035 6364 | sales@2020media.com | We'll Call You

JDBC Case Sensitivity Issues


There are a number of issues surrounding getting JDBC to work with different databases.

The following is extracted from

"JDBC Database Access with Java" by Graham Hamilton & others from Sun
(Addison-Wesley ISDN 0-201-30995-5

"The standard in SQL is that keywords are not case sensitive, so, for example, the following SELECT statement can be written in various ways."
.... 
"Quoted material, however, is case sensitive: ".

"Requirements can vary from one DBMS to another when it comes to identifier names.  For example, some DBMSs require that column and table names be given exactly as they were created in the CREATE TABLE statement, while others do not."
.....
"The only sure way to make patterns database-independent is to discover the way identifiers are stored, (with DatabaseMetaData methods), and then use the appropiate case in identifier name patterns. DatabaseMetaData has several methods for determining whether identifier names are stored in the database as lowercase, mixed case or uppercase

  •  storesLowerCaseIdentifiers
  • storesLowerCaseQuotedIdentifiers
  • storesMixedCaseIdentifiers
  • storedMixedCaseQuotedIdentifiers
  • storesUpperCaseIdentifiers
  • storesUpperCaseQuotedIdentifiers
  • supportsMixedCaseIdentifiers
  • supportsMixedCaseQuotedIdentifiers

If the methods with QuotedIndentifiers in their names return true, they allow nonalphanumeric characters if those characters are enclosed in quotation marks."

I guess what this means is that to ensure compatibility across JDBC drivers the way to do it is to ensure that identifiers are all stored the same way (either upper or lower case, but not a mixture and not quoted) and then use functions to convert appropiately in the code.

 

Comments

Did you find this information useful? Let us have your feedback

2020Media is a leading provider of small business Wi-Fi hotspots. If you want to offer free Wi-Fi to your customers or users, our service could be exactly what you are looking for. Our Hotspots are managed in the cloud, ultra-reliable and give you loads of information about behaviour patterns of your users. Read More   Read more...
2020Media introduces Moodle Hosting - UK servers and UK Moodle experts setup your site ready to use. Read more...
Special Offer for Longer Registration Periods Register or renew a .com, .net or .org domain name for 5 years we'll include 1 year free*. Read more...
2020Media is now offering zero-click installation of the popular TYPO3 content management system. Read more...

Our blog is regularly updated with news, tips and industry opinion.

Clients

  • AggieWestons
  • baker-and-mckenzie
  • arts-council-england
  • Big Finish
  • barratt-developments-logo
  • City-of-Lincoln-council-logo
  • brora-logo
  • DenisMacShane
  • Construction-Industry-Council
  • colchester