异常 java.sql.SQLException: 无法从套接字读取更多的数据

 

使用hibernate执行查询时,报如下异常:

Caused by: java.sql.SQLException: 无法从套接字读取更多的数据
 
at oracle.jdbc.driver.SQLStateMapping.newSQLException(SQLStateMapping.java:74)
 at oracle.jdbc.driver.DatabaseError.newSQLException(DatabaseError.java:110)
 at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:171)
 at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:227)
 at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:439)
 at oracle.jdbc.driver.T4CMAREngine.unmarshalUB1(T4CMAREngine.java:1042)
 at oracle.jdbc.driver.T4CMAREngine.unmarshalSB1(T4CMAREngine.java:999)
 at oracle.jdbc.driver.T4C7Ocommoncall.receive(T4C7Ocommoncall.java:97)
 at oracle.jdbc.driver.T4CConnection.doRollback(T4CConnection.java:613)
 at oracle.jdbc.driver.PhysicalConnection.rollback(PhysicalConnection.java:3389)
 at org.apache.commons.dbcp.DelegatingConnection.rollback(DelegatingConnection.java:265)
 at org.apache.commons.dbcp.DelegatingConnection.rollback(DelegatingConnection.java:265)
 at org.apache.commons.dbcp.PoolingDataSource$PoolGuardConnectionWrapper.rollback(PoolingDataSource.java:288)
 at org.hibernate.transaction.JDBCTransaction.rollbackAndResetAutoCommit(JDBCTransaction.java:183)
 at org.hibernate.transaction.JDBCTransaction.rollback(JDBCTransaction.java:162)
 ... 21 more 

 

 

我的SQL代码如下:

 

select *
  from (select
EIPOD_ID,
               EIPOD_BK_VESSEL,
               EIPOD_BK_VOYAGE,
               EIPOD_WB_NO,
               EIPOD_DISC_PORT_ID,
               EIPOD_CONSIGNEE_NAME,
               CNT_NOS,
               GROSS_WEIGHT,
               EXECUTIVES,
               ADDRESSES,
               RELEASE_WEIGHT
          from (select EIPOD.CREATE_TIME,
                       EIPOD.EIPOD_ID,
                       EIPOD.EIPOD_BK_VESSEL,
                       EIPOD.EIPOD_BK_VOYAGE,
                       EIPOD.EIPOD_WB_NO,
                       EIPOD.EIPOD_DISC_PORT_ID,
                       EIPOD.EIPOD_CONSIGNEE_NAME,
                       GET_CNT_NO(EIPOD.EIPOD_ID, ',') CNT_NOS,
                       nvl((select sum(EIPCI.EIPCI_GROSS_WEIGHT)
                             from EIP_CTNINFO EIPCI
                            where EIPCI.EIPCI_EIPOD_ID = EIPOD.EIPOD_ID),
                           0) GROSS_WEIGHT,
 
    
                  GET_DELIVER_EXECUTIVES(EIPOD.EIPOD_ID, ',') EXECUTIVES,
                       GET_DELIVER_ADDRESSES(EIPOD.EIPOD_ID, ',') ADDRESSES,
                       nvl((select sum(EIPMP_GROSS_WEIGHT)
                             from EIP_MUTIL_PLACE EIPMP
                            where exists (select 1
                                     from EIP_CTNINFO EIPCI
                                    where EIPCI.EIPCI_ID =
                                          EIPMP.EIPMP_EIPCI_ID
                                      and EIPCI.EIPCI_EIPOD_ID =
                                          EIPOD.EIPOD_ID)),
                           0) RELEASE_WEIGHT
                  from EIP_ORDER EIPOD
                  left join SCH_VOYAGE SCHVO on EIPOD.EIPOD_SCHVO_ID =
                                                SCHVO.SCHVO_ID
                  left join VES_SHIP_BASE_INFO VESSI on SCHVO.SCHVO_VESSEL_ID =
                                                        VESSI.VESSI_ID
                 where EIPOD.EIPOD_BK_CONFIRMED_FLAG = '4'
                   and EIPOD.EIPOD_IS_VALID != '0'
                   and EIPOD.EIPOD_WB_NO like 'SUN1104230007' || '%'
                   and ((1 = 1)))
         where GROSS_WEIGHT > 0
         order by CREATE_TIME desc)
 where rownum <= 20 

 

 

解决此异常有两个方法:

1、加大数据库的回滚段

2、修改SQL语句,下面SQL是我所作的修改,仅供参考:

select *
  from (select EIPOD_ID,
               EIPOD_BK_VESSEL,
               EIPOD_BK_VOYAGE,
               EIPOD_WB_NO,
               EIPOD_DISC_PORT_ID,
               EIPOD_CONSIGNEE_NAME,
               CNT_NOS,
               GROSS_WEIGHT,
               EXECUTIVES,
               ADDRESSES,
               RELEASE_WEIGHT
          from (select EIPOD.CREATE_TIME,
                       EIPOD.EIPOD_ID,
                       EIPOD.EIPOD_BK_VESSEL,
                       EIPOD.EIPOD_BK_VOYAGE,
                       EIPOD.EIPOD_WB_NO,
                       EIPOD.EIPOD_DISC_PORT_ID,
                       EIPOD.EIPOD_CONSIGNEE_NAME,
                       GET_CNT_NO(EIPOD.EIPOD_ID, ',') CNT_NOS,
                       nvl(EIP.EIPCI_GROSS_WEIGHT, 0) GROSS_WEIGHT,
 
                      GET_DELIVER_EXECUTIVES(EIPOD.EIPOD_ID, ',') EXECUTIVES,
                       GET_DELIVER_ADDRESSES(EIPOD.EIPOD_ID, ',') ADDRESSES,
                       nvl((select sum(EIPMP_GROSS_WEIGHT)
                             from EIP_MUTIL_PLACE EIPMP
                            where exists (select 1
                                     from EIP_CTNINFO EIPCI
                                    where EIPCI.EIPCI_ID =
                                          EIPMP.EIPMP_EIPCI_ID
                                      and EIPCI.EIPCI_EIPOD_ID =
                                          EIPOD.EIPOD_ID)),
                           0) RELEASE_WEIGHT
                  from EIP_ORDER EIPOD
                  left join SCH_VOYAGE SCHVO on EIPOD.EIPOD_SCHVO_ID =
                                                SCHVO.SCHVO_ID
                  left join VES_SHIP_BASE_INFO VESSI on SCHVO.SCHVO_VESSEL_ID =
                                                        VESSI.VESSI_ID
                  left join (select EIPCI_EIPOD_ID,
                                   sum(EIPCI.EIPCI_GROSS_WEIGHT) EIPCI_GROSS_WEIGHT
                              from EIP_CTNINFO EIPCI
                             group by EIPCI.EIPCI_EIPOD_ID) EIP on EIP.EIPCI_EIPOD_ID =
                                                                   EIPOD.EIPOD_ID
 
                where EIPOD.EIPOD_BK_CONFIRMED_FLAG = '4'
                   and EIPOD.EIPOD_IS_VALID != '0'
                   and EIPOD.EIPOD_WB_NO like 'SUN1104230007' || '%'
                   and ((1 = 1)))
         where GROSS_WEIGHT > 0
         order by CREATE_TIME desc)
 where rownum <= 20

你可能感兴趣的:(Oracle)