Spring jdbc插入CLOB型报错

记忆的美好 发布于 2013/04/22 09:08
阅读 1K+
收藏 1

oracle数据库用的是9i.


org.springframework.jdbc.UncategorizedSQLException: PreparedStatementCallback; uncategorized SQLException for SQL [insert into make_si_card_detail (biz_serial,dept_id,collection_point_no,collection_point_name,initialization_dept_id,card_distribute_date,card_valid_date,si_card_no,si_no,person_name,gender,nation_id,birthday,hukou_address,hukou_type,photo_string,bank_id,bank_card_no,response_si_flag,source)values(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)]; SQL state [null]; error code [17410]; 无法从套接字读取更多的数据; nested exception is java.sql.SQLException: 无法从套接字读取更多的数据
Caused by: java.sql.SQLException: 无法从套接字读取更多的数据
 at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134)
 at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:179)
 at oracle.jdbc.dbaccess.DBError.check_error(DBError.java:1160)
 at oracle.jdbc.ttc7.MAREngine.unmarshalUB1(MAREngine.java:963)
 at oracle.jdbc.ttc7.MAREngine.unmarshalSB1(MAREngine.java:893)
 at oracle.jdbc.ttc7.v8TTILob.receiveReply(v8TTILob.java:955)
 at oracle.jdbc.ttc7.v8TTIClob.createTemporaryLob(v8TTIClob.java:394)
 at oracle.jdbc.ttc7.TTC7Protocol.createTemporaryLob(TTC7Protocol.java:3173)
 at oracle.sql.LobDBAccessImpl.createTemporaryClob(LobDBAccessImpl.java:723)
 at oracle.sql.CLOB.createTemporary(CLOB.java:961)
 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
 at java.lang.reflect.Method.invoke(Method.java:597)
 at org.springframework.jdbc.support.lob.OracleLobHandler$OracleLobCreator.prepareLob(OracleLobHandler.java:393)
 at org.springframework.jdbc.support.lob.OracleLobHandler$OracleLobCreator.createLob(OracleLobHandler.java:340)
 at org.springframework.jdbc.support.lob.OracleLobHandler$OracleLobCreator.setClobAsString(OracleLobHandler.java:265)
 at com.rx.app.jdbcdao.MqBatchRequestDaoImpl$7.setValues(MqBatchRequestDaoImpl.java:351)
 at org.springframework.jdbc.core.JdbcTemplate$4.doInPreparedStatement(JdbcTemplate.java:817)
 at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:527)
 at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:556)
 at org.springframework.jdbc.core.JdbcTemplate.batchUpdate(JdbcTemplate.java:808)
 at com.rx.app.jdbcdao.MqBatchRequestDaoImpl.saveMakeSiCardDetail(MqBatchRequestDaoImpl.java:329)
 at com.rx.app.mqbatch.MqBatchRequestHandler.checkAndSvaeMakeSiCardTrans(MqBatchRequestHandler.java:198)
 at com.rx.app.mqbatch.MqBatchRequestHandler.makeSiCardTrans(MqBatchRequestHandler.java:83)
 at com.rx.app.mqbatch.MqBatchConnection.run(MqBatchConnection.java:102)
 
		StringBuffer sql_save_card_detail = new StringBuffer(128);
		sql_save_card_detail.append("insert into make_si_card_detail (biz_serial,dept_id,collection_point_no,");
		sql_save_card_detail.append("collection_point_name,initialization_dept_id,card_distribute_date,card_valid_date,");
		sql_save_card_detail.append("si_card_no,si_no,person_name,gender,nation_id,birthday,hukou_address,hukou_type,");
		sql_save_card_detail.append("photo_string,bank_id,bank_card_no,response_si_flag,source)");
		sql_save_card_detail.append("values(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)");
		getJdbcTemplate().batchUpdate(sql_save_card_detail.toString(), new BatchPreparedStatementSetter()
		{
			public void setValues(PreparedStatement ps, int i) throws SQLException
			{
				MakeSICardDetail detail = makeSICardDetailList.get(i);
				int j = 1;
				ps.setString(j++, detail.getBizSerial());
				ps.setString(j++, detail.getDeptId());
				ps.setString(j++, detail.getCollectionPointNo());
				ps.setString(j++, detail.getCollectionPointName());
				ps.setString(j++, detail.getInitializationDeptId());
				ps.setString(j++, detail.getCardDistributeDate());
				ps.setString(j++, detail.getCardValidDate());
				ps.setString(j++, detail.getSiCardNo());
				ps.setString(j++, detail.getSiNo());
				ps.setString(j++, detail.getPersonName());
				ps.setString(j++, detail.getGender());
				ps.setString(j++, detail.getNationId());
				ps.setString(j++, detail.getBirthday());
				ps.setString(j++, detail.getHukouAddress());
				ps.setString(j++, detail.getHukouType());
				//TODO
				lobHandler.getLobCreator().setClobAsString(ps, j++,"222222");
				ps.setString(j++, detail.getBankId());
				ps.setString(j++, detail.getBankCardNo());
				ps.setInt(j++, detail.getResponseSiFlag());
				ps.setString(j++, detail.getSource());
			}

			public int getBatchSize()
			{
				return makeSICardDetailList.size();
			}
		});

加载中
0
DanielTo
DanielTo
这个字符 直接用 text 就行,没必要用clob
谁在谁的身旁
回复 @记忆的美好 : odbc14.jar 这个版本低不?我用这个也报这个错误,请问大侠是怎么解决的啊
记忆的美好
记忆的美好
感谢你的回答.我找出原因了...是ojdbc的jar包版本太低,导致这个异常....
记忆的美好
记忆的美好
存的应该是照片的base64字符串,测试的时候我改成"2222222"...方便排错的
返回顶部
顶部