1

After connecting to MariaDB and executing the following command CREATE TABLE ora_emp ENGINE=CONNECT TABLE_TYPE=ODBC TABNAME='tablename' CONNECTION='DSN=ORCL;UID=userid;PWD=pass'; INSERT INTO test.ora_emp(gubun1, gubun2) VALUES ('한', '글') SELECT * FROM ora_emp enter image description here As you can see, it is displayed as ??. How can I resolve this issue?

  1. I have changed all the character sets in MariaDB to euckr. enter image description here
  2. I have added 'Charset = euckr' to the [ORCL] section of the /etc/odbc.ini file.
  3. I have set the environment variable NLS_LANG to KOREAN_KOREA.KO16KSC5601.
  • The `NLS_LANG` environment variable is used to tell the Oracle database which character set is set in the client. So, I assume you must set `NLS_LANG=KOREAN_KOREA.AL32UTF8` – Wernfried Domscheit Jul 13 '23 at 06:58
  • Thank you. I have tried making the changes as you suggested, but the character encoding issue still persists. – dae-hee Kim. Jul 13 '23 at 07:31
  • Before or after inserting the data? You may have inserted junk into your Oracle database. Junk in -> Junk out. And you may have to restart the MariaDB. – Wernfried Domscheit Jul 13 '23 at 07:42
  • try deleting and recreating the oracle connect table, and even though I input Korean characters in MariaDB, they are still displayed as ??, and even though the Korean characters were input correctly in Oracle, they are displayed as ?? in MariaDB. – dae-hee Kim. Jul 13 '23 at 08:23
  • It could be a display issue of your client. What do you get from `DUMP(gubun1, 1016)` How does it look like if you select the data from Oracle directly? – Wernfried Domscheit Jul 13 '23 at 08:43
  • ORACLE output : Typ=1 Len=2 CharacterSet=KO16KSC5601: 3f,3f – dae-hee Kim. Jul 13 '23 at 08:59
  • `x3F` is the question mark `?`, so that's the real data in your database. The problem is at `insert` time. Which tool do you use to run the SQL? The `NLS_LANG` value must be set according to character set of this tool. – Wernfried Domscheit Jul 13 '23 at 10:38
  • I am using sqlyog as the SQL execution tool. The character encoding of the ora_emp table and columns is `euckr`, and the collation is `euckr_korean_ci`. When I insert Korean characters into this table, they are displayed as ??, but when I create another table of the same type using the `InnoDB engine` and insert Korean characters, they are inserted correctly. – dae-hee Kim. Jul 14 '23 at 00:50
  • I am not familiar with MariaDB/sqlyog. Oracle sqlplus inherits the character set from `cmd.exe`, you need to interrogate or modify the character set with `chcp` and set `NLS_LANG` accordingly. See https://stackoverflow.com/questions/33783902/odbcconnection-returning-chinese-characters-as/33790600#33790600 – Wernfried Domscheit Jul 14 '23 at 06:49
  • sorry.. it doesn't work – dae-hee Kim. Jul 18 '23 at 02:54

0 Answers0