In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)05/31 Report--
This article mainly explains the "what are the characteristics of the GBase8s database", the content of the explanation is simple and clear, easy to learn and understand, the following please follow the editor's ideas slowly in depth, together to study and learn "what are the characteristics of GBase8s database"!
Matters needing attention
When we import the data into the GBase8s database, we will build the database, table and field. When these operations are completed, it will be smooth to import some test or sample data at the initial stage. But sometimes when it comes to the formal environment, when there is more data, there are some unexpected special characters or obscure words in it, which will cause us to fail to import. Therefore, this document records the matters needing attention to deal with obscure words in the process of building GBase8s database.
Key environmental variables
N DB_LOCALE
Meaning:
The database locale set through the DB_LOCALE environment variable specifies the language, locale, and code set required by the database server to correctly interpret locale-related data types (NCHAR and NVARCHAR) in a particular database. The code set specified in DB_LOCALE determines which characters are valid in any character column and determines the names of database objects, such as databases, tables, columns, and views. The database server uses the database code set specified by the DB_LOCALE environment variable to pass data into and out of the database.
Purpose:
1. When the client application and the database server exchange character data, if the value of the DB_LOCALE environment variable (on the client computer) is different from the value of CLIENT_LOCALE, the client application will perform a code set conversion. Code set conversion prevents data corruption between the two types of code sets.
two。 When the client application requests a connection, it sends information including DB_LOCALE (if set) to the database server.
3. The database server uses DB_LOCALE when determining how to set up the server to handle database information for the locale.
4. When the client application attempts to open the database, the database server compares the value of the DB_LOCALE environment variable passed by the client application with the database locale stored in the database.
5. When the database server accesses columns of locale-related data types, the database server uses the locale specified by DB_LOCALE.
6. When the database server creates a new database, it examines the database locale (DB_LOCALE) to determine how character information is stored in the system directory of the database. This information includes actions such as how to handle regular expressions, compare strings, and ensure the correct use of the code set.
So if our database needs to support Chinese characters, we must set this variable to zh_CN.utf8 or zh_cn.GB18030-2000 when building the database. Otherwise, if the database is built according to en_us.8859-1, it will become garbled after the noon character is inserted. The following is a comparison table of character set names and codes
Character set name
Coding
8859-1
eight hundred and nineteen
Gb
57357
GB2312-80
57357
Utf8
57372
Big5
57352
GB18030-2000
5488
Character set name and code comparison table
N GL_USEGLU
Meaning:
If you want the data in the fields of the NCHAR and NVARCHAR data types to support unicode, you must set the GL_USEGLU environment variable using the
So if our database needs to support not only Chinese characters but also obscure characters, we must open this variable before building the database.
Actual operation
We need to insert the obscure word "" into the database. According to the description just now, we need to set up two places correctly to ensure that the word "" can be successfully entered into the database.
Let's first use the echo $DB_LOCALE; command to see the current value of this variable
Found that the current value of this variable is not zh_CN.utf8 or zh_cn.GB18030-2000
So we need to modify the variables before we set up the database.
Second, we need to use the onstat-g env command to confirm that GL_USEGLU is set up.
When these two variables are set, we use dbaccess to set up the database testdb3
Create a table and add a record of obscure words, as shown in the following figure. The operation is successful.
Use the following statement to confirm the encoding of the current database, which shows zh_CN.57372. According to the character set name and coding comparison table just now, we can see that the character set name corresponding to code 57372 is utf8.
SELECT * FROM sysmaster:sysdbslocale WHERE dbs_dbsname like 'testdb3%'
Here's how we test when the GL_USEGLU variable is not set
We invalidate GL_USEGLU through the unset GL_USEGLU command variable
Use the onstat-g env command to view the current environment variable and find that there is no GL_USEGLU environment variable
At this time, we set up the testdb4 database through dbaccess.
If we insert the strange word "" just now, we will report an error of 34389 Illegal character illegal characters as shown in the following figure.
Let's test the insertion of normal Chinese characters.
There is no problem with inserting normal Chinese characters.
Thank you for your reading, the above is the content of "what are the characteristics of GBase8s database". After the study of this article, I believe you have a deeper understanding of the characteristics of GBase8s database, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.