如果使用ENGINE=MyISAM DEFAULT CHARSET=gbk COLLATE=gbk_bin ROW_FORMAT=DYNAMIC  插入不报错,页面显示也没问题,但数据字段值,变成这样了

解决方案 »

  1.   

    用UTF8,但注意你客户端,程序中的字符集也要相应设置正确。http://blog.csdn.net/ACMAIN_CHM/archive/2009/05/12/4174186.aspx
    MySQL 中文显示乱码
      

  2.   

    谢谢.使用utf-8显示没有问题,使用客户端工具SQLyog Enterprise,也可以进行修改,删除.
    但在程序中,就不行.报Caused by: org.hibernate.exception.DataException: Could not execute JDBC batch update
    Caused by: com.mysql.jdbc.MysqlDataTruncation: Data truncation: Data too long for column 'TITLE' at row 1
    肯定不是字段长度的问题.
      

  3.   

    Caused by: com.mysql.jdbc.MysqlDataTruncation: Data truncation: Data too long for column 'TITLE' at row 1贴出建表语句以及更新语句
      

  4.   

    在JAVA中转换成UTF8内容?
    SQL语句是什么
      

  5.   


    谢谢.已搞定.
    问题的原因是,程序与数据库的链接也要用utf-8,不然,估计转sql会出问题,报 Data truncation: Data too long for column 这样的错误