Kbase P162823: How to convert a database from a US codepage to Chinese GB2312, if all data characters in the databa
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  03/01/2011 |
|
Status: Verified
GOAL:
How to convert a database from a US codepage to Chinese GB2312, if all data characters in the database are found in the GB2312 code page?
GOAL:
How to convert a database from a US codepage to Chinese GB2312?
GOAL:
How to convert from a US codepage to Chinese GB2312?
GOAL:
Is it possible to convert an American ISO8859-1 code page to Chinese GB2312?
GOAL:
How to change a database code page?
FACT(s) (Environment):
All Supported Operating Systems
Progress 9.1E
Progress 9.1D
OpenEdge 10.x
FIX:
You can take one of two approaches, either with or without a dump and load.
WARNING: Before you start either process, have a good backup of your database.
Valid and Invalid Code-page Conversions:
You can convert a database and its data from one code page (the source code-page) to another code page (the target code page) if one of both of the following conditions are true:
1. Every Character that appears in the source code page appears in the target code page.
2. Every character that appears in the database appears in the target code page.
If these can not be met the conversion will not be valid and will result in corruption.
This solution is assuming that condition 2 is met, as all the characters of the US code pages are not in the GB2312 code page.
To convert without dump and load, follow these steps:
1) Compile a new version of word break table for GB2312 to a rule number <N>. (In OpenEdge 10.1A and later, if word rules have not been customized then this is not necessary, there is a default GB2312 word rule file named proword.251 in the installation directory that can be used instead):
proutil <database> -C wbreak-compiler %DLC%\prolang\convmap\GB2312bas.wbt <N>
Use an absolute path to DLC instead of the environment variable in the command line.
Where <N> is number between 1 and 255 of your choosing.
2) Place the new created file proword.<N> in %DLC% or define the environment variable PROWD<N>=<file-directory>\proword.<N> (in Progress Version 9.0A you must set PROWD<N>).
3) Convert your database to an undefined code page, because all character in the ISO8859 are not found in the GB2312 code page:
proutil dbname -C convchar convert undefined
4) Convert the database to the desired code page:
proutil dbname -C convchar convert GB2312
5) Apply the new word-rules to the database:
proutil <database> -C word-rules <N>
Note: <N> is the number chosen in step 1 above, For example:
proutil sports -C word-rules 10
6) Use the Data Administration tool to load the file %DLC%\prolang\sch\GB2312\_tran.df in order to change the database collation.
Note: If your Database was created before 10.1A (in example 10.0B) and you are going to load the _tran.df in 10.1A or newer, you need to do the following before being able to load the _tran.df.
proutil <database> -C updateschema
This will bring the Database Schema to 10.1A and you will able to load the _tran.df for database collation.
7) Rebuild the indexes:
proutil <database> -C idxbuild ALL -cpinternal GB2312
Note: If the log file is to be in another code page, set the -cplog startup parameter to the desired target code page.
Example of startup parameter:
-cplog ISO8859-1
/SPAN>
To convert using dump and load follow the steps below.
Please note that once you have completed steps 3 and 4, they do not need to be repeated for subsequent databases on the same system.
WARNING: Prior to OpenEdge 10.0A Binary dump does not record the code page of the text being written to the dump file. You must use the Data Dictionary Dump Table Contents plus either the Data Dictionary Load Table Contents or the bulkload utility. In OpenEdge 10 Binary Dump does record the code page of the text being written to the dump file, and this can only be loaded into a database that uses the same code page. This ensures that there is no possibility of data corruption when loading the data. Failure to load into a database with exactly the same code page will result in error 10855:
Code page of .bd file (<name>) does not match code page of database(<name>). (10855)
1) Dump the existing database using the Data Administration tool. Set the dump code page to "undefined".
2) Create a new empty GB2312 database of the desired blocksize:
prodb <new_database> %DLC%\prolang\sch\gb2312\empty(#).db
3) Compile a new version of word break table for GB2312 to a rule number <N>. (In OpenEdge 10.1A and later, if word rules have not been customized then this is not necessary, there is a default GB2312 word rule file named
proword.251 in the installation directory that can be used instead):
proutil <database> -C wbreak-compiler %DLC%\prolang\convmap\gb2312bas.wbt <N>
Where <N> is number between 1 and 255 of your choosing.
4) Place the newly created file proword.<N> in %DLC% or define the environment variable PROWD<N>=<file-directory>\proword.<N> (in Version 9.0A you have to set PROWD<N>).
5) Apply the new word rules to the database:
proutil <database> -C word-rules <N>
Where <N> is the number chosen in step 3 above.
6) Load the database..