Programmer Guide : Working with Unicode : Compatibility between Unicode and partial Unicode databases : Converting partial Unicode databases to Unicode
  
Converting partial Unicode databases to Unicode
To convert a partial Unicode database to a Unicode database, use the solidDB® tools to export and reload your database.
Before you begin
Create a backup of your database.
Verify the locale/codepage that is used in the application side for encoding data in CHAR data type columns in the partial Unicode database.
During the export phase, the data in CHAR data type columns is not converted by solidDB® tools; instead, it is output as such. This means that the underlying locale/codepage for CHAR data types becomes the locale/codepage format for the output file. To enable the output files to contain data in a single locale/codepage, solidDB® must be able to convert the data in the WCHAR data type columns from UTF-16 into the exact same locale/codepage format as the CHAR data.
In the import phase, the solidDB® tools convert the data from the locale/codepage format of the output file into the UTF-8 (CHAR) and UTF-16 (WCHAR) encoding used in Unicode databases.
About this task
In this procedure, the following setup is used as an example:
The server name is solidDB® and the protocol used for connections is TCP/IP, using port 1964 (network name is “tcpip 1964”).
The partial Unicode database has been created with the username “dbadmin” and password “password”.
CHAR data types in the partial Unicode database are encoded in the application side with the locale zh_CN.gb18030 (Chinese/China and code page GB18030).
Tip: If you have your database creation scripts available, you can use them to create the new database table definitions, instead of using soldd and solsql for exporting and importing them.
Procedure
1 Extract data definitions with solidDB® Data Dictionary (soldd).
Use the following command to extract an SQL script containing definitions for all tables, views, triggers, indexes, procedures, sequences, and events.
soldd -Mzh_CN.gb18030 "tcpip 1964" dbadmin password
The default file name soldd.sql is used.
User and role definitions are not listed for security reasons. If the database contains users or roles, add CREATE statements for them to the extracted SQL file manually.
Important: To preserve referential integrity, you may need to reorganize the table definition statements to ensure that the referenced tables are created before the referencing tables.
2 Extract data from you database with solidDB® Export (solexp). Use the following command to extract the control and data files for all tables.
solexp -Mzh_CN.gb18030 "tcpip 1964" dbadmin password *
This export creates control files (<table_name>.ctr) and data files (<table_name>.dat) for each table. The default file name is the same as the exported table name.
3 Create a new Unicode database.
a Set the General.InternalCharEncoding parameter to UTF8.
[General]
InternalCharEncoding=UTF8
b Create a new database by starting solidDB® in the working directory for the new Unicode database.
4 Import data definitions into the new database using the solidDB® SQL Editor (solsql).
Use the following command to execute the SQL script created by solidDB® Data Dictionary (soldd).
solsql -fsoldd.sql -Mzh_CN.gb18030 "tcpip 1964" dbadmin password
5 Load the data into the new database using the solidDB® Speed Loader (solloado).
For each table, use the following command to load data into the new database:
solloado -Mzh_CN.gb18030 "tcpip 1964" dbadmin password <table_name>.ctr
Related topics
Using solidDB® management tools in the solidDB® Administrator Guide.
See also
Compatibility between Unicode and partial Unicode databases