jdbc:mysql://localhost/Test?useUnicode=true&characterEncoding=GB2312
我是这样连接的取的时候是这样写的System.out.println(sqlRst.getString(2))结果给我打印的是 ???à 这是怎么回事呀,还需要加什么别的代码吗?

解决方案 »

  1.   

    jdbc:mysql://localhost/Test?useUnicode=true&characterEncoding=GB2312
    写成下面看
    jdbc:mysql://localhost:3306/Test?useUnicode=true&characterEncoding=GB2312
      

  2.   

    查看编码样式show variables like %char%
    然后用set ....=utf8
    给俺点分吧,没分下东东了
      

  3.   

    String mm1=rs.getString("name");
    String mm2=new String(mm1.getBytes("iso-8859-1"),"gbk");
      

  4.   

    在你的my.ini文件中修改
    [mysqld]
    default-character-set=utf8[client]
    default-character-set=utf8
    不过你可能重启数据库,还要删除原有的数据库,重新建立