Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

java的gbk的列名乱码 #1

Open
zygzx opened this issue Feb 6, 2017 · 0 comments
Open

java的gbk的列名乱码 #1

zygzx opened this issue Feb 6, 2017 · 0 comments

Comments

@zygzx
Copy link

zygzx commented Feb 6, 2017

1、MariaDB [svcall]> show variables like 'character%';
+--------------------------+----------------------------+
| Variable_name | Value |
+--------------------------+----------------------------+
| character_set_client | gbk |
| character_set_connection | gbk |
| character_set_database | gbk |
| character_set_filesystem | binary |
| character_set_results | gbk |
| character_set_server | gbk |
| character_set_system | utf8 |
| character_sets_dir | /usr/share/mysql/charsets/ |

2、mycat system的下面已经设置 charset gbk

3、 java代码:
rs = stmt.executeQuery(selSql); ---这里单步调试显示中文正常 selSql= select a as 第一列 ,b as 第二列 from test;
//System.out.println(selSql);
ResultSetMetaData rsmd = rs.getMetaData(); //这里获取出来是乱码。
int columnCount = rsmd.getColumnCount();

这个语句在mycat中命令行中执行是正确显示的。
select a as 第一列 ,b as 第二列 from test; 这个语句在mycat中执行是正常的

java直接连mysql也是正常的。

知道如何调整?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant