利用itabis进行数据库查询操作时,控制台抛出这个异常:- com.ibatis.common.jdbc.exception.NestedSQLException:
- --- The error occurred in sqlMap_etlJobQueue.xml.
- --- The error occurred while applying a parameter map.
- --- Check the select_putJobIntoQueue-InlineParameterMap.
- --- Check the statement (query failed).
- --- Cause: java.sql.SQLException: ORA-00911: invalid character
在网上查了一下说是oracle字符集设置的问题。另外抛异常的SQL语句在控制台输出如下:- 2012-08-28 14:21:23,655 DEBUG jdbc.SimpleDataSource (JakartaCommonsLoggingImpl.java:debug(27)) - Created connection 9377143.
- 2012-08-28 14:21:23,732 DEBUG sql.Connection (JakartaCommonsLoggingImpl.java:debug(27)) - {conn-100000} Connection
- 2012-08-28 14:21:23,744 DEBUG sql.Connection (JakartaCommonsLoggingImpl.java:debug(27)) - {conn-100000} Preparing Statement: select COALESCE(max(seqID),0) as seqID from etl_job_queue;
- 2012-08-28 14:21:24,000 DEBUG sql.PreparedStatement (JakartaCommonsLoggingImpl.java:debug(27)) - {pstm-100001} Executing Statement: select COALESCE(max(seqID),0) as seqID from etl_job_queue;
- 2012-08-28 14:21:24,001 DEBUG sql.PreparedStatement (JakartaCommonsLoggingImpl.java:debug(27)) - {pstm-100001} Parameters: []
- 2012-08-28 14:21:24,002 DEBUG sql.PreparedStatement (JakartaCommonsLoggingImpl.java:debug(27)) - {pstm-100001} Types: []
- 2012-08-28 14:21:24,033 DEBUG jdbc.SimpleDataSource (JakartaCommonsLoggingImpl.java:debug(27)) - Returned connection 9377143 to pool.
出错的语句如下:
select COALESCE(max(seqID),0) as seqID from etl_job_queue;这是因为在ibatis sqlmap配置文件中定义语句时sql后面多了一个分号。这样的话在PL/SQL中是无所谓的,可是Java 的数据库驱动却不识别这样的语句了。
阅读(5131) | 评论(0) | 转发(0) |