错误提示:SqlMapClient operation; uncategorized SQLException for SQL []; SQL state [null]; error code [17004];

这个问题已经折腾我两天了,今天终于在一位同事(zhangwei)的帮助下解决了。

1.起初没有创建序列s_log,因此需要在Oracle补上s_log序列。

<!-- 增加 日志 -->
<insert id="logSave"
parameterClass="com.reportcenter.sys.dto.OperateLogDto">
INSERT INTO
T_LOG(C_AUTOID,USRCDE,USRADDRESS,OPERATION,BEGINTME,ENDTME,OPERATETIMER,STATE,MESSAGE) VALUES(s_log.nextval,#usrCde#,#usrAddress#,#operation#,#beginTme#,#endTme#,#operateTimer#,#state#,#message#)
</insert>

2.接着就出现下面的问题,主要是usrCde(日志表里的用户代码)属性在系统登陆验证时为空值所致。因此在相应代码处加上对空值的判断,如果为空,就从登陆页面取得userCde值。

if (request.getSession().getAttribute(Constants.usrCde) == null) {
usr = request.getParameter("userCde");
} else {
usr = (String) request.getSession().getAttribute(
Constants.usrCde);
}

Tomcat提示错误如下:

INFO [org.springframework.beans.factory.xml.XmlBeanDefinitionReader] - Loading XML bean definitions from class path resource [org/springframework/jdbc/support/sql-error-codes.xml]
INFO [org.springframework.jdbc.support.SQLErrorCodesFactory] - SQLErrorCodes loaded: [DB2, Derby, H2, HSQL, Informix, MS-SQL, MySQL, Oracle, PostgreSQL, Sybase]
org.springframework.jdbc.UncategorizedSQLException: SqlMapClient operation; uncategorized SQLException for SQL []; SQL state [null]; error code [17004];
--- The error occurred in sqlmap-mapping-log-operate.xml.
--- The error occurred while applying a parameter map.
--- Check the logSave-InlineParameterMap.
--- Check the parameter mapping for the 'usrCde' property.
--- Cause: java.sql.SQLException: 无效的列类型; nested exception is com.ibatis.common.jdbc.exception.NestedSQLException:
--- The error occurred in sqlmap-mapping-log-operate.xml.
--- The error occurred while applying a parameter map.
--- Check the logSave-InlineParameterMap.
--- Check the parameter mapping for the 'usrCde' property.
--- Cause: java.sql.SQLException: 无效的列类型
Caused by: com.ibatis.common.jdbc.exception.NestedSQLException:
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134)
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:179)
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:269)
at oracle.jdbc.driver.OracleStatement.get_internal_type(OracleStatement.java:6164)
at oracle.jdbc.driver.OraclePreparedStatement.setNull(OraclePreparedStatement.java:1316)
at org.apache.commons.dbcp.DelegatingPreparedStatement.setNull(DelegatingPreparedStatement.java:105)
at com.ibatis.sqlmap.engine.mapping.parameter.BasicParameterMap.setParameter(BasicParameterMap.java:171)
at com.ibatis.sqlmap.engine.mapping.parameter.BasicParameterMap.setParameters(BasicParameterMap.java:125)
at com.ibatis.sqlmap.engine.execution.SqlExecutor.executeUpdate(SqlExecutor.java:79)
at com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.sqlExecuteUpdate(GeneralStatement.java:200)
at com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeUpdate(GeneralStatement.java:78)
... 37 more
com.reportcenter.exception.DaoException: error.sys.log.db.add; nested exception is
org.springframework.jdbc.UncategorizedSQLException: SqlMapClient operation; uncategorized SQLException for SQL []; SQL state [null]; error code [17004];
--- The error occurred in sqlmap-mapping-log-operate.xml.
--- The error occurred while applying a parameter map.
--- Check the logSave-InlineParameterMap.
--- Check the parameter mapping for the 'usrCde' property.
--- Cause: java.sql.SQLException: 无效的列类型;

 

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 3
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值