1. Apache 한글 처리
아파치쪽에서 설정 잡아줘야 하는것이 있나 모르겠다.. -_-
2. Tomcat 한글 처리
단순하게 각각의 컨넥터에 캐릭터셋을 지정해주고..
DB Pool 리소스에 캐릭터인코딩을 euckr로 지정해주면 끝.
#vi /usr/local/tomcat/conf/server.xml
…
…
<Resource name="jdbc/dbname" auth="Container"
type="javax.sql.DataSource"
driverClassName="com.mysql.jdbc.Driver"
loginTimeout="10"
maxWait="5000"
username="username"
password="password"
testOnBorrow="true"
url="jdbc:mysql://XXX.XXX.XXX.XXX:3306/db_name?characterEncoding=euckr"/>
…
…
<!-- Define a non-SSL HTTP/1.1 Connector on port 8080 -->
<Connector port="8080" maxHttpHeaderSize="8192"
maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
enableLookups="false" redirectPort="8443" acceptCount="100"
connectionTimeout="20000" disableUploadTimeout="true" URIEncoding="EUC-KR"/>
…
…
<!-- Define an AJP 1.3 Connector on port 8009 -->
<Connector port="8009"
enableLookups="false" redirectPort="8443" protocol="AJP/1.3" URIEncoding="EUC-KR"/>
3. MySQL 한글 처리
my.cnf에 아래 내용 추가
#vi /etc/my.cnf
[mysql]
default-character-set=euckr
[mysqld]
character-set-client-handshake=FALSE
init_connect="SET collation_connection=euckr_korean_ci"
init_connect="SET NAMES euckr"
default-character-set=euckr
character-set-server=euckr
collation-server = euckr_korean_ci
[client]
default-character-set = euckr
[mysqldump]
default-character-set = euckr
mysql에서 확인
mysql> show variables like 'c%';
+--------------------------+----------------------------+
| Variable_name | Value |
+--------------------------+----------------------------+
| character_set_client | euckr |
| character_set_connection | euckr |
| character_set_database | euckr |
| character_set_filesystem | binary |
| character_set_results | euckr |
| character_set_server | euckr |
| character_set_system | utf8 |
| character_sets_dir | /usr/share/mysql/charsets/ |
| collation_connection | euckr_korean_ci |
| collation_database | euckr_korean_ci |
| collation_server | euckr_korean_ci |
| completion_type | 0 |
| concurrent_insert | 1 |
| connect_timeout | 5 |
+--------------------------+----------------------------+
mysql> status
--------------
mysql Ver 14.12 Distrib 5.0.44sp1, for redhat-linux-gnu (x86_64) using readline 5.0
Connection id: 4
Current database:
Current user: root@localhost
SSL: Not in use
Current pager: stdout
Using outfile: "
Using delimiter: ;
Server version: 5.0.44sp1-enterprise-gpl-log MySQL Enterprise Server (GPL)
Protocol version: 10
Connection: Localhost via UNIX socket
Server characterset: euckr
Db characterset: euckr
Client characterset: euckr
Conn. characterset: euckr
UNIX socket: /var/lib/mysql/mysql.sock
Uptime: 13 min 39 sec
Threads: 3 Questions: 419 Slow queries: 0 Opens: 13 Flush tables: 1 Open tables: 7 Queries per second avg: 0.512
--------------