์ต๊ทผ์ ์๊ฒ๋ ์ง์์ ๊ณต์ ํ๊ณ ์ ํฌ์คํ ์ ๋จ๊น๋๋ค.
์๋ ๊ทธ๋ฆผ์ฒ๋ผ EUC-KR(MSWIN949)๋ก ์ธ์ฝ๋ฉ์ค์ ์ด ๋์ด์๋ DB์ varcharํ์ ์ ์ปฌ๋ผ์ ํ๊ธ์ ๋ฃ์ด๋์์ต๋๋ค.
select dump()๋ฅผ ์ด์ฉํด์ ๋ค์ด๊ฐ์๋ ๋ฐ์ดํ๋ฅผ ํฅ์ฌ๊ฐ์ผ๋ก ์ถ๋ ฅํด๋ณด๋ฉด 2๋ฐ์ดํธ์ง๋ฆฌ๋ก ํ๊ธ์ด ์ ๋ค์ด๊ฐ์์์ ํ์ธํ ์ ์์์ต๋๋ค.
๊ทธ๋ฐ๋ฐ ์๋ฐ ์ ํ๋ฆฌ์ผ์ด์ ์์ ์ด ๊ฐ์ Resultset.getBytes()๋ก ์ฝ์ด์์ ์ถ๋ ฅํด๋ณด๋ 3๋ฐ์ดํธ UTF-8 ์ธ์ฝ๋ฉ์ผ๋ก ๋ณํ์ด ๋์ด์์์ต๋๋ค.
euc-kr ๋ฐ์ดํธ๋ฅผ ์ฝ์ด์์ ์ฒ๋ฆฌ๋ฅผ ํด์ผํ๊ธฐ ๋๋ฌธ์ ๋ฌธ์ ๊ฐ ์๊ธด ๊ฒ์ธ๋ฐ์.
์ค๋ผํด ๋ฌธ์๋ฅผ ์ฐพ์๋ดค๋๋ ๋ค์๊ณผ ๊ฐ์ ๋ถ๋ถ์ด ์์์ต๋๋ค.
How JDBC Drivers Perform Globalization Support Conversions
The techniques that the Oracle JDBC drivers use to perform
character set conversion for Java applications depend on the character
set the database uses. The simplest case is where the database uses the US7ASCII
or WE8ISO8859P1
character set. In this case, the driver converts the data directly from the database character set to UTF-16
, which is used in Java applications, and vice versa.
If you are working with databases that employ a non-US7ASCII
or non-WE8ISO8859P1
character set (for example, JA16SJIS
or KO16KSC5601
), then the driver converts the data first to UTF-8
(this step does not apply to the server-side internal driver), then to UTF-16
. For example, the driver always converts CHAR
and VARCHAR2
data in a non-US7ASCII
, non-WE8ISO8859P1
character set. It does not convert RAW
data.
Note:
The JDBC drivers perform all character set conversions transparently. No user intervention is necessary for the conversions to occur.
์ค๋ผํด ๋๋ผ์ด๋ฒ๊ฐ ํ๊ธ์ ๊ธฐ๋ณธ์ ์ผ๋ก utf-8 ๋ฐ์ดํ๋ก ๋ณํ์ ํ๋ค๋ ๊ฒ์ด์์ต๋๋ค.
๋ฐ๋ผ์ ์๋ฐ ์ ํ๋ฆฌ์ผ์ด์ ์์ ์ฝ์ด๋ค์ผ ๋ Resulset.getBytes()๋ก ์ฝ์ด์ค๋ฉด utf-8๋ก ์ธ์ฝ๋ฉ๋ ๋ฐ์ดํ๊ฐ ๋์ค๊ฒ ๋๋ ๊ฒ์ด์ฃ .
๊ทธ๋์ getBytes()ํ๋ ๊ฒ์ getString()์ผ๋ก ๋ฐ๊พธ๊ณ String.getBytes(encoding) ์ผ๋ก bytes๋ฅผ ์ฝ์ด์ค๋๋ก ๋ฐ๊ฟ์ ์ด ๋ฌธ์ ๋ฅผ ํด๊ฒฐํ์ต๋๋ค.
Reference : http://docs.oracle.com/cd/B10500_01/java.920/a96654/advanc.htm
'๐ป Programming > Oracle 11g' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
[Oracle 11g] ์ค๋ผํด ํ๊ธ ๊นจ์ง (UTF-8์ผ๋ก ๋ณ๊ฒฝ) (0) | 2015.04.20 |
---|---|
[์ค๋ผํด/oracle11g] dump ํจ์ (0) | 2015.04.20 |
ํ ์ด๋ธ ์ ์ฝ์ฌํญ ์กฐํํ๊ธฐ ( Querying constraints of a table ) (0) | 2015.04.14 |
Rename์ ์ด์ฉํ ํ ์ด๋ธ ๋ฐฑ์ ( Table Backup using Renaming ) (0) | 2015.04.14 |
ํ ์ด๋ธ ๋ช ๋ณ๊ฒฝํ๊ธฐ ( Renaming Table Name ) (0) | 2015.04.14 |