简体   繁体   English

DB2数据库名称是否区分大小写

[英]DB2 database name is case sensitive or not

In my DB2, I created database with name 'SAMPLE'. 在我的DB2中,我创建了名为'SAMPLE'的数据库。 And, while connect with Razor DB2 client, it can connect to 'SAMPLE' database without case-sensitive. 而且,在与Razor DB2客户端连接时,它可以连接到'SAMPLE'数据库而不区分大小写。

For example, 例如,

jdbc:db2://localhost:50000/sAmple JDBC:DB2://本地主机:50000 /样本

jdbc:db2://localhost:50000/Sample JDBC:DB2://本地主机:50000 /样本

jdbc:db2://localhost:50000/saMple JDBC:DB2://本地主机:50000 /样本

jdbc:db2://localhost:50000/SAMPLE JDBC:DB2://本地主机:50000 /样品

They all can connect to DB2. 它们都可以连接到DB2。 But when I take results with them, only SAMPLE database can show results. 但是当我用它们取结果时,只有SAMPLE数据库才能显示结果。 I want to know that how I can connect to DB2 with only 'SAMPLE' database name with case-sensitive. 我想知道如何只使用区分大小写的'SAMPLE'数据库名称连接到DB2。

DB2 databases are not case sensitive SAMPlE = sample = SAMple . DB2数据库不区分大小写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 ) 可能,他们考虑了实例目录( 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. 例如, EMPLOYEE = employee ,但该表在数据库目录中存储为EMPLOYEE However, you can force the name in lower case by surrounding by quotes, like "employee" , but this is considered as a bad practice. 但是,您可以通过引号括起来强制使用小写名称,例如"employee" ,但这被认为是一种不好的做法。 In the other hand, database name does not keep the case is surrounded by quotes. 另一方面,数据库名称不保持大小写引号括起来。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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