`
bj0828
  • 浏览: 8649 次
  • 性别: Icon_minigender_1
  • 来自: 北京
最近访客 更多访客>>
文章分类
社区版块
存档分类
最新评论

【原创】DB2数据库乱码造成启动Tomcat5.5加载数据抛出异常!-已经解决

阅读更多
从DB2服务器导出文本数据导入本机,启动Tomcat5.5报错大概日志如下org.springframework.jdbc.UncategorizedSQLException: Hibernate operation: could not execute query; uncategorized SQLException for SQL [select this_.ID as ID9_0_, this_.PARENTID as PARENTID9_0_, this_.CODE as CODE9_0_, this_.REMARK as REMARK9_0_, this_.CODE_DICT as CODE5_9_0_, this_.SORTINDEX as SORTINDEX9_0_, this_.NAME as NAME9_0_, this_.ADDITIONAL_CTRL as ADDITIONAL8_9_0_, this_.VALID_FLAG as VALID9_9_0_, this_.DISPLAY_FLAG as DISPLAY10_9_0_ from SYS_DICTIONARY this_ order by this_.SORTINDEX asc]; SQL state [null]; error code [-99999]; null; nested exception is com.ibm.db2.jcc.c.SqlException
Caused by:
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'bdcAccnReportQueryService' defined in URL [file:/E:/software/Tomcat5.5/webapps/cim/WEB-INF/classes/module/base/spring-service-info.xml]: Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'noTranBatcher' defined in URL [file:/E:/software/Tomcat5.5/webapps/cim/WEB-INF/classes/module/base/spring-service-info.xml]: Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sysDictionaryService' defined in URL [file:/E:/software/Tomcat5.5/webapps/cim/WEB-INF/classes/module/base/spring-service-info.xml]: Invocation of init method failed; nested exception is org.springframework.jdbc.UncategorizedSQLException: Hibernate operation: could not execute query; uncategorized SQLException for SQL [select this_.ID as ID9_0_, this_.PARENTID as PARENTID9_0_, this_.CODE as CODE9_0_, this_.REMARK as REMARK9_0_, this_.CODE_DICT as CODE5_9_0_, this_.SORTINDEX as SORTINDEX9_0_, this_.NAME as NAME9_0_, this_.ADDITIONAL_CTRL as ADDITIONAL8_9_0_, this_.VALID_FLAG as VALID9_9_0_, this_.DISPLAY_FLAG as DISPLAY10_9_0_ from SYS_DICTIONARY this_ order by this_.SORTINDEX asc]; SQL state [null]; error code [-99999]; null; nested exception is com.ibm.db2.jcc.c.SqlException
Caused by:
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'noTranBatcher' defined in URL [file:/E:/software/Tomcat5.5/webapps/cim/WEB-INF/classes/module/base/spring-service-info.xml]: Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sysDictionaryService' defined in URL [file:/E:/software/Tomcat5.5/webapps/cim/WEB-INF/classes/module/base/spring-service-info.xml]: Invocation of init method failed; nested exception is org.springframework.jdbc.UncategorizedSQLException: Hibernate operation: could not execute query; uncategorized SQLException for SQL [select this_.ID as ID9_0_, this_.PARENTID as PARENTID9_0_, this_.CODE as CODE9_0_, this_.REMARK as REMARK9_0_, this_.CODE_DICT as CODE5_9_0_, this_.SORTINDEX as SORTINDEX9_0_, this_.NAME as NAME9_0_, this_.ADDITIONAL_CTRL as ADDITIONAL8_9_0_, this_.VALID_FLAG as VALID9_9_0_, this_.DISPLAY_FLAG as DISPLAY10_9_0_ from SYS_DICTIONARY this_ order by this_.SORTINDEX asc]; SQL state [null]; error code [-99999]; null; nested exception is com.ibm.db2.jcc.c.SqlException
Caused by:
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sysDictionaryService' defined in URL [file:/E:/software/Tomcat5.5/webapps/cim/WEB-INF/classes/module/base/spring-service-info.xml]: Invocation of init method failed; nested exception is org.springframework.jdbc.UncategorizedSQLException: Hibernate operation: could not execute query; uncategorized SQLException for SQL [select this_.ID as ID9_0_, this_.PARENTID as PARENTID9_0_, this_.CODE as CODE9_0_, this_.REMARK as REMARK9_0_, this_.CODE_DICT as CODE5_9_0_, this_.SORTINDEX as SORTINDEX9_0_, this_.NAME as NAME9_0_, this_.ADDITIONAL_CTRL as ADDITIONAL8_9_0_, this_.VALID_FLAG as VALID9_9_0_, this_.DISPLAY_FLAG as DISPLAY10_9_0_ from SYS_DICTIONARY this_ order by this_.SORTINDEX asc]; SQL state [null]; error code [-99999]; null; nested exception is com.ibm.db2.jcc.c.SqlException
Caused by:
org.springframework.jdbc.UncategorizedSQLException: Hibernate operation: could not execute query; uncategorized SQLException for SQL [select this_.ID as ID9_0_, this_.PARENTID as PARENTID9_0_, this_.CODE as CODE9_0_, this_.REMARK as REMARK9_0_, this_.CODE_DICT as CODE5_9_0_, this_.SORTINDEX as SORTINDEX9_0_, this_.NAME as NAME9_0_, this_.ADDITIONAL_CTRL as ADDITIONAL8_9_0_, this_.VALID_FLAG as VALID9_9_0_, this_.DISPLAY_FLAG as DISPLAY10_9_0_ from SYS_DICTIONARY this_ order by this_.SORTINDEX asc]; SQL state [null]; error code [-99999]; null; nested exception is com.ibm.db2.jcc.c.SqlException
Caused by:
com.ibm.db2.jcc.c.SqlException
at com.ibm.db2.jcc.c.s.a(s.java:1517)
at com.ibm.db2.jcc.c.s.m(s.java:465)
at com.ibm.db2.jcc.c.s.M(s.java:1102)
at com.ibm.db2.jcc.c.lf.getString(lf.java:959)
at com.ibm.db2.jcc.c.lf.getString(lf.java:1290)
at org.apache.commons.dbcp.DelegatingResultSet.getString(DelegatingResultSet.java:224)
at org.hibernate.type.StringType.get(StringType.java:18)
at org.hibernate.type.NullableType.nullSafeGet(NullableType.java:113)
at org.hibernate.type.NullableType.nullSafeGet(NullableType.java:102)
at org.hibernate.type.AbstractType.hydrate(AbstractType.java:81)
at org.hibernate.persister.entity.AbstractEntityPersister.hydrate(AbstractEntityPersister.java:2031)
at org.hibernate.loader.Loader.loadFromResultSet(Loader.java:1371)
at org.hibernate.loader.Loader.instanceNotYetLoaded(Loader.java:1299)
at org.hibernate.loader.Loader.getRow(Loader.java:1197)
at org.hibernate.loader.Loader.getRowFromResultSet(Loader.java:568)
at org.hibernate.loader.Loader.doQuery(Loader.java:689)
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:224)
at org.hibernate.loader.Loader.doList(Loader.java:2144)
at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2028)

======================================================================

【解决方法】:经过48小时的折腾结果发现,从服务器导出的文本数据是GBK编码,而DB2数据库在建数据库的时候选择的是UTF-8编码,所以导入本地数据库后中文是乱码和null,只要把服务器导出来的文本数据使用记事本或其它的编辑器(如:EditPlus,UltraEdit等)把文本文件保存为UTF-8格工,重新再导入数据库即可!
1
1
分享到:
评论

相关推荐

    db2数据库安装包、db2数据库安装驱动

    db2数据库安装包 db2数据库链接服务器驱动 db2数据库安装方法

    DB2数据库数据类型

    DB2数据库数据类型DB2数据库数据类型DB2数据库数据类型

    DB2数据库控制中心乱码问题解决方法

    DB2数据库控制中心乱码问题解决方法集合 在英文操作系统上,经常会出现DB2数据库控制中心乱码现象。 第1种方法: 把D:\Program Files\IBM\SQLLIB\java\jdk\jre\lib\font.properties.zh中的filename.SimSun=SimSun...

    Linux系统重启db2数据库命令实例详解.docx

    启动数据库: 启动db2服务:db2start 激活数据库实例:db2 activate database <db_name> 查看激活状态的数据库:db2 list active databases 关闭数据库: 失效数据库实例:db2 deactivate database <db_name> 关闭...

    Db2数据库操作的常用命令列表

    Db2数据库操作的常用命令列表, Db2数据库操作的常用命令列表

    db2数据库错误解决代码sqlcode

    db2数据库错误解决代码sqlcode db2数据库错误解决代码sqlcode

    DB2数据库性能调整和优化 牛新庄 PDF

    深刻理解DB2的锁及并发机制、索引原理、数据库参数、优化器原理、SQL语句调优等内部机理才能针对性地快速提出解决问题的方法;快照、db2pd、db2expln及事件监控器等则是必须熟练掌握的工具。《DB2数据库性能调整和...

    DB2数据库相关操作笔记很实用-数据备份,数据还原,定时备份等

    1. 注意事项 2. 数据库安装 ...—— 6.1 检查并启动DB2数据库服务 —— 6.2 查看数据库并手动备份 —— 6.3 慎用【频繁的停止数据库】 7. 数据库完全卸载 —— 7.1 卸载注意事项 —— 7.2 卸载DB2数据库

    db2数据库培训文档

    db2数据库培训文档db2数据库培训文档db2数据库培训文档db2数据库培训文档db2数据库培训文档db2数据库培训文档db2数据库培训文档db2数据库培训文档db2数据库培训文档db2数据库培训文档db2数据库培训文档db2数据库培训...

    db2数据库性能优化小技巧

    db2数据库性能优化小技巧

    JDBC连接DB2数据库需要的jar包

    JDBC连接DB2数据库需要的jar包 JDBC连接DB2数据库需要的jar包 JDBC连接DB2数据库需要的jar包

    DB2数据库实践基础教程

    资源名称:DB2数据库实践基础教程 内容简介:《DB2数据库实践基础教程》是《数据库原理与DB2应用教程》(杨鑫华、丁传华、赵慧敏编著,北京,清华大学出版社,2007年)的配套教材,着重于对实践操作的介绍,包括DB2...

    DB2数据库学习资料

    对大家学习DB2数据库非常有帮助!!!!!!

    DB2数据库用户手册

    DB2数据库用户手册DB2数据库用户手册DB2数据库用户手册DB2数据库用户手册DB2数据库用户手册DB2数据库用户手册DB2数据库用户手册DB2数据库用户手册DB2数据库用户手册

    远程连接db2数据库

    远程连接db2数据库远程连接db2数据库远程连接db2数据库远程连接db2数据库远程连接db2数据库远程连接db2数据库远程连接db2数据库远程连接db2数据库远程连接db2数据库

    连接db2数据库驱动包

    pom.xml中引入db2的配置信息 <groupId>com.ibm.db2</groupId> <artifactId>db2jcc4 <version>1.0.0 <scope>system 自己创建的存放db2jcc4.jar路径 <groupId>com.ibm.db2</groupId> ...

    db2通用数据库自学教程

    db2通用数据库自学教程db2通用数据库自学教程db2通用数据库自学教程db2通用数据库自学教程db2通用数据库自学教程db2通用数据库自学教程db2通用数据库自学教程db2通用数据库自学教程db2通用数据库自学教程db2通用...

    DB2数据库与SQLServer数据库的异同.doc

    DB2数据库与SQLServer数据库的异同 DB2、Oracle、SQLServer数据库可以说是数据库领域的三座大山。这三座大山各有各的 特色。为此企业在选型的时候往往会在这三个数据库之间犹豫,不知道该选哪个数据库 好。笔者这里...

    DB2数据库常用命令手册

    该资源为日常用的DB2数据库命令,包括一些注意事项(例如启动数据库,停止数据库什么的,最基础的),个人觉得蛮好用的,分享一下

    DB2数据库实战手册(Part 3)

    1、《DB2数据库实战手册》由DB2china超级版主彭建军(论坛ID:pengjianjun)耗时数月而成; 2、《DB2数据库实战手册》顾名思义是一本以实战教程为主的书籍,内容涵盖了16期DB2入门开窍版和专家坐诊版块中绝大多数...

Global site tag (gtag.js) - Google Analytics