• java jdbc->mycat->oracle SqlException异常中文信息乱码解决


    mycat字符集gbk

    oracle字符集gbk

    原jdbc连接串:

    base.jdbc.url=jdbc:mysql://127.0.0.1:3306/XXX?useUnicode=true&characterEncoding=gbk

    错误信息:

    A.D_OUTPUTDATE = 0 THEN ' ' ELSE TO_CHAR(A.D_OUTPUTDATE) END) D_OUTPUTDATE     , NVL(B.C_CUSTNAME, ' ') C_CUSTNAME     , NVL(B.C_IDENTITYPE, ' ') C_IDENTITYPE     , NVL(B.C_IDENTITYNO, ' ') C_IDENTITYNO     , (CASE WHEN A.D_REQOUTPUTDATE = 0 THEN ' ' ELSE TO_CHAR(A.D_REQOUTPUTDATE) END) D_REQOUTPUTDATE     , A.C_FORCEREDEMPTIONTYPE     , A.C_MEMO     , A.F_REQRDMBALANCE     , A.F_PROTECTBALANCE    FROM      ta_tconfirm_his A        LEFT JOIN ta_taccoinfo B ON  A.C_FUNDACCO = B.C_FUNDACCO AND A.C_TENANTID  = B.C_TENANTID      LEFT JOIN ta_tagencyinfo C ON A.C_AGENCYNO = C.C_AGENCYNO AND A.C_TENANTID = C.C_TENANTID      LEFT JOIN ta_tbusinflag D ON A.C_BUSINFLAG = D.C_BUSINFLAG AND A.C_TENANTID = D.C_TENANTID        LEFT JOIN ta_terrormess E ON A.C_CAUSE = E.C_CAUSE AND A.C_TENANTID = E.C_TENANTID        LEFT JOIN ta_tfundinfo F ON A.C_FUNDCODE = F.C_FUNDCODE AND A.C_TENANTID = F.C_TENANTID        LEFT JOIN ta_tnetinfo H ON A.C_NETNO = H.C_NETNO AND A.C_AGENCYNO=H.C_AGENCYNO AND A.C_TENANTID = H.C_TENANTID         WHERE A.C_TENANTID = ?                     AND A.c_tacode = ?                                                                            AND A.D_CDATE  >= ?                                        AND A.D_CDATE  <= ?                                                                AND A.C_FUNDCODE IN (     SELECT fundcode FROM role_fundcode WHERE role_id IN     (      ?     )     AND fundcode IN(SELECT c_fundcode FROM ta_tfundinfo)     UNION ALL     SELECT ' ' AS fundcode FROM dual     UNION ALL      SELECT '*' AS fundcode FROM dual    )          ) C
    ### Cause: java.sql.SQLException: ORA-00942: ????????????
    
    ; uncategorized SQLException for SQL []; SQL state [HY000]; error code [1105]; ORA-00942: ????????????
    ; nested exception is java.sql.SQLException: ORA-00942: ????????????
    
        at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:83) ~[spring-jdbc-3.2.14.RELEASE.jar:3.2.14.RELEASE]
        at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:80) ~[spring-jdbc-3.2.14.RELEASE.jar:3.2.14.RELEASE]
        at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:80) ~[spring-jdbc-3.2.14.RELEASE.jar:3.2.14.RELEASE]
        at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:74) ~[mybatis-spring-1.2.3.jar:1.2.3]
        at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:399) ~[mybatis-spring-1.2.3.jar:1.2.3]
        at com.sun.proxy.$Proxy40.selectOne(Unknown Source) ~[?:?]
        at org.mybatis.spring.SqlSessionTemplate.selectOne(SqlSessionTemplate.java:165) ~[mybatis-spring-1.2.3.jar:1.2.3]
        at net.hs.cw.bomp.engine.service.JdbcServiceEngine.selectPageCount(JdbcServiceEngine.java:498) ~[bomp-runtime-1.0.0-SNAPSHOT.jar:?]
        at net.hs.cw.bomp.engine.service.JdbcServiceEngine.callQueryService(JdbcServiceEngine.java:460) ~[bomp-runtime-1.0.0-SNAPSHOT.jar:?]
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.7.0_45]
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) ~[?:1.7.0_45]
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.7.0_45]
        at java.lang.reflect.Method.invoke(Method.java:606) ~[?:1.7.0_45]

    mycat中不是乱码,如下:

    06/26 14:45:19.609   WARN [BusinessExecutor1] (MultiNodeHandler.java:126) -error response from JDBCConnection [id=68,autocommit=true,pool=org.opencloudb.jdbc.JDBCDatasource@1dbc0e73, schema=hs_tatrade2, dbType=ORACLE, oldSchema=hs_tatrade2, packetId=-55, txIsolation=0, running=false, borrowed=false, host=null, port=-1, con=oracle.jdbc.driver.T4CConnection@12645708, respHandler=null, attachement=null, headerOutputed=false, modifiedSQLExecuted=false, startTime=1529975130206, lastTime=1529995519607, isSpark=false, processor=org.opencloudb.net.NIOProcessor@2558af45] err ORA-00942: 表或视图不存在

    增加characterSetResults=gbk,如下:

    base.jdbc.url=jdbc:mysql://127.0.0.1:3306/bomp_test?useUnicode=true&characterEncoding=gbk&characterSetResults=gbk

    异常信息如下:

    ### Cause: java.sql.SQLException: ORA-00942: 表或视图不存在
    
    ; uncategorized SQLException for SQL []; SQL state [HY000]; error code [1105]; ORA-00942: 表或视图不存在
    ; nested exception is java.sql.SQLException: ORA-00942: 表或视图不存在
    
        at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:83) ~[spring-jdbc-3.2.14.RELEASE.jar:3.2.14.RELEASE]
        at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:80) ~[spring-jdbc-3.2.14.RELEASE.jar:3.2.14.RELEASE]
        at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:80) ~[spring-jdbc-3.2.14.RELEASE.jar:3.2.14.RELEASE]
        at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:74) ~[mybatis-spring-1.2.3.jar:1.2.3]
        at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:399) ~[mybatis-spring-1.2.3.jar:1.2.3]
        at com.sun.proxy.$Proxy40.selectOne(Unknown Source) ~[?:?]

    问题解决,mycat->oracle,比较尴尬,准备sharding-jdbc->oracle。

    参考:

    https://blog.csdn.net/zyf814/article/details/17021949

  • 相关阅读:
    RHEL7: How to configure a rc-local service
    安装 jemalloc for mysql
    aws rhel 7 安装GUI ,配置VNC
    官方推荐的MySQL参数设置值
    Linux HugePages及MySQL 大页配置
    Linux Transparent Huge Pages 对 Oracle 的影响
    Linux的Transparent Hugepage与关闭方法
    Linux HugePages 配置与 Oracle 性能关系说明
    How To Change Log Rate Limiting In Linux
    MySQL 8.0窗口函数
  • 原文地址:https://www.cnblogs.com/zhjh256/p/9229663.html
Copyright © 2020-2023  润新知