[size=medium]通过网上学习,要求修改Hibernate的配置文件hibernate.cfg.xml,将原来的
jdbc:mysql://localhost:3306/shopping
改为
jdbc:mysql://localhost:3306/shopping?useUnicode=true&characterEncoding=utf-8
或改为
jdbc:mysql://localhost:3306/shopping?useUnicode=true&characterEncoding=gbk
最后指定哪种编码方式要看数据库是什么样的编码方式。[/size]
使用Hibernate向mysql数据库中插入中文,数据库中显示??乱码
最新推荐文章于 2019-04-10 13:46:15 发布