[
https://issues.apache.org/jira/browse/TRAFODION-2366?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15967218#comment-15967218
]
苏锦佩 commented on TRAFODION-2366:
--------------------------------
I found that after doing below steps, odb work well with chinese of utf8
encoding.
1. Install unixODBC from source with below configure.
$ tar xf unixODBC-2.3.4.tar.gz
$ ./configure --disable-gui --disable-drivers --enable-stats=no --enable-iconv
--with-iconv-char-enc=UTF8 --with-iconv-ucode-enc=UTF16LE
$ make
$ sudo make install
2. Config DSN with the option ClientCharSet=UTF8 (Case sensitive, thanks
for rachel’s reminder), for example:
[TRAF_UTF8]
Description = Default Data Source
Catalog = TRAFODION
Schema = RACHEL_ODBCTEST_U8
DataLang = 0
FetchBufferSize = SYSTEM_DEFAULT
Server = TCP:10.10.10.173:23400
ClientCharSet = UTF8
SQL_ATTR_CONNECTION_TIMEOUT = SYSTEM_DEFAULT
SQL_LOGIN_TIMEOUT = SYSTEM_DEFAULT
Test Result:
create table test003(id int, name varchar(16) CHARACTER SET UTF8, text
varchar(256) CHARACTER SET UTF8);
#./odb64luo -u trafodion -p traf123 -d traf -l
src=/root/trafodion/odb/bin/test:tgt=TRAFODION.QA.TEST003:fs=\|:rows=1000:loadcmd=UL:truncate:parallel=4
#cat /root/trafodion/odb/bin/test
--------------
1|jjjjj|kkkkkddd
2|中国|dddd
3|jjd|哪里
4|那到底|的地方
--------------
trafci:
select * from TEST003; ID NAME TXT
----------- ----------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------------------
1 jjjjj kkkkkddd
2 中国 dddd
3 jjd 哪里
4 那到底 的地方
--- 4 row(s) selected.
> odb copy or load with Chinese characters will return gibberish
> --------------------------------------------------------------
>
> Key: TRAFODION-2366
> URL: https://issues.apache.org/jira/browse/TRAFODION-2366
> Project: Apache Trafodion
> Issue Type: Bug
> Reporter: zhangliang
> Assignee: zhangliang
> Priority: Minor
>
> odb cmd is
> ./odb64luo -u zale -p zale -d gy_poc -l
> src=sample.csv:tgt=trafodion.odb_copy.load_ch:max=500000:rows=5000:parallel=2:loadcmd=UL:fs=,:bad=bad2
> File to load with Chinese characters is like
> ...
> SW001600,测试,2000/1/29 13:05:00,2.62,
> SW001600,测试,2000/1/29 13:25:00,2.62,
> SW001600,测试,2000/1/29 14:10:00,2.61,
> SW001600,测试,2000/1/29 09:55:00,2.63,
> SW001600,测试,2000/1/29 13:35:00,2.62,
> SW001600,测试,2000/1/29 11:00:00,2.64,
> SW001600,测试,2000/1/29 13:45:00,2.62,
> ...
> While select from sqlci or DB manager, return gibberish, like:
> ST_STATIONID ST_STATIONNAME
> DT_TIME NM_OUTWATER NM_INWATER
> --------------------
> ------------------------------------------------------------
> ------------------- -------------- ------------
> HY007415 大æ¢å±±
> 2000-01-01 10:00:00 0.00 NULL
> HY007415 大æ¢å±±
> 2000-01-02 10:00:00 0.00 NULL
> PDHFA366 äºå·æ²
> 1970-01-01 00:50:00 1.56 NULL
> SW001100 ç½åº
> 2000-01-01 12:00:00 1.56 NULL
> SW001600 äºå·æ²
> 2000-01-29 09:25:00 2.63 NULL
> SW001600 äºå·æ²
> 2000-01-29 09:30:00 2.63 NULL
> SW001600 äºå·æ²
> 2000-01-29 09:35:00 2.63 NULL
> ...
> HY007415 大æ¢å±± 946692000000 0
> HY007415 大æ¢å±± 946778400000 0
> PDHFA366 äºå·æ² -25800000 1.56
> SW001100 ç½åº 946699200000 1.56
> SW001600 äºå·æ² 949109100000 2.63
> SW001600 äºå·æ² 949109400000 2.63
> The same as copy function.
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)