我现在的项目是Strust2+Spring+ MyBatis3.0,因为项目中有个需求需要调用存储过程,我在MyBatis的配置文件里这样写了
<!-- 调用存储过程计算请假时长 -->
<parameterMap type="map" id="LeaveApplyDetailMap">
<parameter property="strEmployeeNo" jdbcType="VARCHAR" javaType="java.lang.String" mode="IN"/>
<parameter property="beginDate" jdbcType="DATE" javaType="java.util.Date" mode="IN"/>
<parameter property="endDate" jdbcType="DATE" javaType="java.util.Date" mode="IN"/>
<parameter property="typeNo" jdbcType="VARCHAR" javaType="java.lang.String" mode="IN"/>
<parameter property="resultCode" jdbcType="VARCHAR" javaType="java.lang.String" mode="OUT"/>
<parameter property="resultData" jdbcType="VARCHAR" javaType="java.lang.String" mode="OUT"/>
</parameterMap>
<!-- 检查请假日期是否有效 -->
<select id="LeaveCheck" parameterMap="LeaveApplyDetailMap">
CALL PKG_ATT.SP_Get_LeaveCheck(#{strEmployeeNo},#{beginDate},#{endDate},#{typeNo},#{resultCode},#{resultData})
</select>
这时在程序里调用时是这样写的:
Map map = new HashMap<String, Object>();
map.put("strEmployeeNo",detail.getStrEmployeeNo());
map.put("beginDate", detail.getBeginDate());
map.put("endDate", detail.getEndDate());
map.put("typeNo", detail.getStrTypeNo());
map.put("resultCode", "0");
map.put("resultData", "0");
dao.get("LeaveCheck", map);
程序调用时就报错的,
DEBUG - ==> Executing: CALL PKG_ATT.SP_Get_LeaveCheck(?,?,?,?,?,?)
DEBUG - ==> Parameters: 11050020(String), 2011-06-15 09:21:00.0(Timestamp), 2011-06-15 20:21:00.0(Timestamp), 1005(String), 0(String), 0(String)
INFO - Loading XML bean definitions from class path resource [org/springframework/jdbc/support/sql-error-codes.xml]
INFO - SQLErrorCodes loaded: [DB2, Derby, H2, HSQL, Informix, MS-SQL, MySQL, Oracle, PostgreSQL, Sybase]
DEBUG - xxx Connection Closed
INFO - [c3p0] Exceptions occurred while trying to close a PooledConnection's resources normally.
ERROR - mapperKeyId:【LeaveCheck】执行失败 ;错误原因:org.springframework.jdbc.UncategorizedSQLException:
### Error querying database. Cause: java.sql.SQLException: 无法从套接字读取更多的数据
### The error may involve cn.machi.oa.atte.dao.impl.LeaveApplyDAOImpl.LeaveApplyDetailMap
### The error occurred while setting parameters
### Cause: java.sql.SQLException: 无法从套接字读取更多的数据
; uncategorized SQLException for SQL []; SQL state [null]; error code [17410]; 无法从套接字读取更多的数据; nested exception is java.sql.SQLException: 无法从套接字读取更多的数据
org.springframework.jdbc.UncategorizedSQLException:
### Error querying database. Cause: java.sql.SQLException: 无法从套接字读取更多的数据
### The error may involve cn.machi.oa.atte.dao.impl.LeaveApplyDAOImpl.LeaveApplyDetailMap