开发者社区> 问答> 正文

Spring jdbc插入CLOB型报错?报错

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();
			}
		});

展开
收起
爱吃鱼的程序员 2020-06-22 20:05:59 697 0
1 条回答
写回答
取消 提交回答
  • https://developer.aliyun.com/profile/5yerqm5bn5yqg?spm=a2c6h.12873639.0.0.6eae304abcjaIB

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

    2020-06-22 20:06:14
    赞同 展开评论 打赏
问答排行榜
最热
最新

相关电子书

更多
云栖社区特邀专家徐雷Java Spring Boot开发实战系列课程(第20讲):经典面试题与阿里等名企内部招聘求职面试技巧 立即下载
微服务架构模式与原理Spring Cloud开发实战 立即下载
阿里特邀专家徐雷Java Spring Boot开发实战系列课程(第18讲):制作Java Docker镜像与推送到DockerHub和阿里云Docker仓库 立即下载

相关实验场景

更多