SQL state [72000]; error code [1013]; ORA-03111: 通信通道收到中断; java.sql.SQLException: ORA-01745: 无效的主机/绑定变量名;java.sql.SQLException: ORA-01013: 用户请求取消当前的操作

1、oracle批量插入

2、java.sql.SQLException: ORA-01745: 无效的主机/绑定变量名(数据太多的时候出现解决方法限制条数插入)

 

/**
     * 按指定大小,分隔集合,将集合按规定个数分为n个部分
     * @param <T>
     * 
     * @param list
     * @param len
     * @return
     */
    public static <T> List<List<T>> splitList(List<T> list, int len) {
        
        if (list == null || list.isEmpty() || len < 1) {
            return Collections.emptyList();
        }

        List<List<T>> result = new ArrayList<>();

        int size = list.size();
        int count = (size + len - 1) / len;

        for (int i = 0; i < count; i++) {
            List<T> subList = list.subList(i * len, ((i + 1) * len > size ? size : len * (i + 1)));
            result.add(subList);
        }
        
        return result;
    }

 

3、SQL state [72000]; error code [1013]; ORA-03111: 通信通道收到中断

解决方法 修改timeout

<insert timeout="100" id="insertList" parameterType="java.util.List" >
        INSERT INTO deal_cp(
        id,
        batch_number,
        code,
        name,
        card,
        bank_card,
        money,
        dates,
        time,
        shop_name,
        batch_numbernew,
        visitor,
        visitor_card,
        end_date,
        moneynew,
        service_type,
        idnew,
        start_date,
        start_dates,
        start_time,
        end_dates,
        end_time,
        data_status,
        data_type,
        bank_ID
        )
        <foreach collection="list" item="dealCp" separator="union all">
              SELECT #{dealCp.id,jdbcType=VARCHAR},
            #{dealCp.batchNumber,jdbcType=VARCHAR},
            #{dealCp.code,jdbcType=VARCHAR},
            #{dealCp.name,jdbcType=VARCHAR},
            #{dealCp.card,jdbcType=VARCHAR},
            #{dealCp.bankCard,jdbcType=VARCHAR},
            #{dealCp.money,jdbcType=VARCHAR},
            #{dealCp.dates,jdbcType=VARCHAR},
            #{dealCp.time,jdbcType=VARCHAR},
            #{dealCp.shopName,jdbcType=VARCHAR},
            #{dealCp.batchNumbernew,jdbcType=VARCHAR},
            #{dealCp.visitor,jdbcType=VARCHAR},
            #{dealCp.visitorCard,jdbcType=VARCHAR},
            #{dealCp.endDate,jdbcType=DATE},
            #{dealCp.moneynew,jdbcType=VARCHAR},
            #{dealCp.serviceType,jdbcType=VARCHAR},
            #{dealCp.idnew,jdbcType=VARCHAR},
            #{dealCp.startDate,jdbcType=DATE},
            #{dealCp.startDates,jdbcType=VARCHAR},
            #{dealCp.startTime,jdbcType=VARCHAR},
            #{dealCp.endDates,jdbcType=VARCHAR},
            #{dealCp.endTime,jdbcType=VARCHAR},
            #{dealCp.dataStatus,jdbcType=CHAR},
            #{dealCp.dataType,jdbcType=CHAR},
            #{dealCp.bankId,jdbcType=VARCHAR}
            FROM dual
          </foreach>
    </insert>

 4、java.sql.SQLException: ORA-01013: 用户请求取消当前的操作
 解决方法 修改timeout

posted @ 2019-06-26 23:02  杜小二  阅读(5472)  评论(0编辑  收藏  举报