Connector/J (JDBC) Reference
2079
and newer, and
character_set
system variable for server versions older than 4.1.0. The driver
automatically uses the encoding specified by the server. For more information, see
Section 10.1.3.1,
“Server Character Set and Collation”
.
For example, to use 4-byte UTF-8 character sets with Connector/J, configure the MySQL server with
character_set_server=utf8mb4
[443]
, and leave
characterEncoding
out of the Connector/J
connection string. Connector/J will then autodetect the UTF-8 setting.
To override the automatically detected encoding on the client side, use the
characterEncoding
property in the URL used to connect to the server.
To allow multiple character sets to be sent from the client, use the UTF-8 encoding, either by
configuring
utf8
as the default server character set, or by configuring the JDBC driver to use UTF-8
through the
characterEncoding
property.
When specifying character encodings on the client side, use Java-style names. The following table lists
MySQL character set names and the corresponding Java-style names:
Table 20.26. MySQL to Java Encoding Name Translations
MySQL Character Set Name
Java-Style Character Encoding Name
ascii
US-ASCII
big5
Big5
gbk
GBK
sjis
SJIS (or Cp932 or MS932 for MySQL
Server < 4.1.11)
cp932
Cp932 or MS932 (MySQL Server >
4.1.11)
gb2312
EUC_CN
ujis
EUC_JP
euckr
EUC_KR
latin1
Cp1252
latin2
ISO8859_2
greek
ISO8859_7
hebrew
ISO8859_8
cp866
Cp866
tis620
TIS620
cp1250
Cp1250
cp1251
Cp1251
cp1257
Cp1257
macroman
MacRoman
macce
MacCentralEurope
utf8
UTF-8
ucs2
UnicodeBig
Warning
Do not issue the query
set names
with Connector/J, as the driver will not
detect that the character set has changed, and will continue to use the character
set detected during the initial connection setup.
20.3.5.5. Connecting Securely Using SSL
Summary of Contents for 5.0
Page 1: ...MySQL 5 0 Reference Manual ...
Page 18: ...xviii ...
Page 60: ...40 ...
Page 396: ...376 ...
Page 578: ...558 ...
Page 636: ...616 ...
Page 844: ...824 ...
Page 1234: ...1214 ...
Page 1427: ...MySQL Proxy Scripting 1407 ...
Page 1734: ...1714 ...
Page 1752: ...1732 ...
Page 1783: ...Configuring Connector ODBC 1763 ...
Page 1793: ...Connector ODBC Examples 1773 ...
Page 1839: ...Connector Net Installation 1819 2 You must choose the type of installation to perform ...
Page 2850: ...2830 ...
Page 2854: ...2834 ...
Page 2928: ...2908 ...
Page 3000: ...2980 ...
Page 3122: ...3102 ...
Page 3126: ...3106 ...
Page 3174: ...3154 ...
Page 3232: ...3212 ...