简体   繁体   中英

DB2 database name is case sensitive or not

In my DB2, I created database with name 'SAMPLE'. And, while connect with Razor DB2 client, it can connect to 'SAMPLE' database without case-sensitive.

For example,

jdbc:db2://localhost:50000/sAmple

jdbc:db2://localhost:50000/Sample

jdbc:db2://localhost:50000/saMple

jdbc:db2://localhost:50000/SAMPLE

They all can connect to DB2. But when I take results with them, only SAMPLE database can show results. I want to know that how I can connect to DB2 with only 'SAMPLE' database name with case-sensitive.

DB2 databases are not case sensitive SAMPlE = sample = SAMple . However:

  • Some tools need the upper case in order to work. Probably, they take into account the instance directory ( db2 list db directory )
  • The database name is changed to upper case for internal identification and it is stored like this in the database catalog. And any function that use the database name should be in upper case.

This behavior is similar to a table. For example, EMPLOYEE = employee , but the table is stored as EMPLOYEE in the database catalog. However, you can force the name in lower case by surrounding by quotes, like "employee" , but this is considered as a bad practice. In the other hand, database name does not keep the case is surrounded by quotes.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM