数据库乱码解决,应注意事项 --struts+spring+hibernate环境下
2008-09-16 23:11
363 查看
在struts+spring+hibernate环境下配置数据库,要让数据库显示中文,需要修改数据目录/下的my.ini文件(我用得是mysql),修改两处地方如下,红色字体为要修改的地方
记住以下几点:
1、一定要两个地方同时修改,否则还会显示乱码
2、修改完了以后要记得把原先的数据库,表重新建立一遍,否则程序会出现问题(具体原因我也不是很清楚啊)。
3、搞定以上两点后重新启动以下数据库服务器即可。
client] port=3306 [mysql] default-character-set=gb2312 # SERVER SECTION # ---------------------------------------------------------------------- # # The following options will be read by the MySQL Server. Make sure that # you have installed the server correctly (see above) so it reads this # file. # [mysqld] # The TCP/IP Port the MySQL Server will listen on port=3306 #Path to installation directory. All paths are usually resolved relative to this. basedir="C:/Program Files/MySQL/MySQL Server 5.0/" #Path to the database root datadir="C:/Program Files/MySQL/MySQL Server 5.0/Data/" # The default character set that will be used when a new schema or table is # created and no character set is defined default-character-set=gb2312 |
1、一定要两个地方同时修改,否则还会显示乱码
2、修改完了以后要记得把原先的数据库,表重新建立一遍,否则程序会出现问题(具体原因我也不是很清楚啊)。
3、搞定以上两点后重新启动以下数据库服务器即可。
相关文章推荐
- struts hibernate spring 环境配置时出现 HTTP Status 404 Servlet action is not available (解决方法)
- Struts + Spring + Hibernate + Mysql中文乱码问题解决
- SSH(Struts+Spring+Hibernate)架构项目修改数据库密码但不重启应用的解决思路
- Struts + Spring + Hibernate + Mysql中文乱码问题解决
- struts、spring、hibernate中文乱码问题解决
- MyEclipse+Struts+Spring+Hibernate 环境配置
- struts2.1.8+spring2.5+hibernate3+EetJs结合struts2-json-plugin-2.1.8.1.jar得到json数据注意事项
- Struts+Spring+Hibernate连接数据库的三个方法
- spring4.06 hibernate4.31 struts2.3.16 全注解MAVEN环境搭建
- Spring 3.x 升级到Spring 4.x 注意事项和步骤,错误解决方法
- spring-hibernate 数据库出现乱码
- Spring+Hibernate+Struts之懒加载问题的解决
- Spring多数据源使用注解事务绑定注意事项和解决办法
- <转载>Spring 3.x 升级到Spring 4.x 注意事项和步骤,错误解决方法
- JSTL+Spring+Hibernate中文乱码问题解决
- Spring3-hibernate3.3-struts2.1.8----环境搭建(2)
- 【转载】struts+spring+hibernate无法插入数据库数据的问题
- Spring+Hibernate应用中怎样解决中文乱码问题
- hibernate连接oracle数据库注意事项
- Eclipse下搭建struts、spring、hibernate开发环境