救急!!用过Jdbc连接MySQL4.1以后版本的麻烦帮个忙!,见者有分
我以前使用MySQl4.0.18 + Connector/J 3.1.3 Alpha版
做数据库操作一切都很正常
但是由于这个版本的MySQL不支持一些嵌套查询的SQL语句,我现在改用MySQL4.1.1
可随之出现的问题是中文不能正确显示了,之前是没有这个问题的
我连库还是一样连的
jdbc:mysql://localhost/dbname?useUnicode=true&characterEncoding=gb2312
后来我看到Mysql的文档中有这么一段
Prior to MySQL Server 4.1, Connector/J supported a single character encoding per connection, which could either be automatically detected from the server configuration, or could be configured by the user through the useUnicode and characterEncoding properties.
Starting with MySQL Server 4.1, Connector/J supports a single character encoding between client and server, and any number of character encodings for data returned by the server to the client in ResultSets.
The character encoding between client and server is automatically detected upon connection. The encoding used by the driver is specified on the server via the configuration variable 'character_set' for server versions older than 4.1.0 and 'character_set_server' for server versions 4.1.0 and newer. See the "Server Character Set and Collation" section in the MySQL server manual for more information.
To override the automatically-detected encoding on the client side, use the characterEncoding property in the URL used to connect to the server.
When specifying character encodings on the client side, Java-style names should be used. The following table lists Java-style names for MySQL character sets:
MySQL Character Set Name Java-Style Character Encoding Name
-----------------------------------------------------------
gbk GBK
gb2312 EUC_CN
latin1 ISO8859_1
............
文档在这儿:http://dev.mysql.com/doc/connector/j/en/index.html#id2803738
我理解是不是我连库的URL中的characterEncoding 应该设置为Java-style的EUC_CN或者GBK(原来是gb2312),但是这样子还是不行
麻烦各位给我提提建议呢,我该怎么办?