Note that there are some explanatory texts on larger screens.

plurals
  1. POjava.sql.SQLException: ORA-01002: fetch out of sequence on XATransaction
    primarykey
    data
    text
    <p>On the same data sometimes throws the exception java.sql.SQLException: ORA-01002: fetch out of sequence, but in most attempts all working fine.</p> <p>Java app running on Glassfish 3.1.2.2. Can anybody explain me, where is the problem?</p> <pre><code>@Singleton @LocalBean @Startup @ConcurrencyManagement(ConcurrencyManagementType.BEAN) public class MarketCodesSingleton { @Resource(mappedName="jdbc/sss") private DataSource source; private volatile static Map&lt;Interval, String&gt; marketCodes; @PostConstruct @Schedule(minute="*/10", hour="*") public void fillMarketCodes() { try(Connection conn = source.getConnection()) { Map&lt;Interval, String&gt; marketCodesInt = new TreeMap&lt;&gt;(); DaoFactory.getMarketCodesDao().fillMarketCodes(marketCodesInt, conn); marketCodes = Collections.unmodifiableMap(marketCodesInt); Logger.getLogger(getClass().getName()).log(Level.FINE, "MarketCodes updated"); } catch (SQLException e) { Logger.getLogger(getClass().getName()).log(Level.SEVERE, "fillMarketCodes exception",e); throw new EJBException("fillMarketCodes exception",e); } } public String getMarketCode(Long msisdn) { Interval interval = new Interval(msisdn); return marketCodes.get(interval); } } </code></pre> <p>DaoFactory.getMarketCodesDao().fillMarketCodes:</p> <pre><code>private static final String getMarketCodes_SQL = "CALL SERVICE_PKG.GET_MARKET_CODES(?)"; @Override public void fillMarketCodes(Map&lt;Interval, String&gt; intervals, Connection conn) throws SQLException { try (CallableStatement cs = conn.prepareCall(getMarketCodes_SQL)) { //-10 is a OracleTypes.CURSOR cs.registerOutParameter(1, -10); cs.execute(); try (ResultSet rs = (ResultSet) cs.getObject(1)) { //*******Exception throws on the rs.next() in this method******* while (rs.next()) { Interval interval = new Interval(rs.getLong("from_no"), rs.getLong("to_no")); intervals.put(interval, rs.getString("market_code")); } } } } </code></pre> <p>Procedure:</p> <pre><code> procedure GET_MARKET_CODES( c_cursor OUT SYS_REFCURSOR ) AS BEGIN OPEN c_cursor FOR SELECT from_no, to_no, market_code FROM market_codes; END GET_MARKET_CODES; </code></pre> <p>Connection properties:</p> <pre><code>&lt;jdbc-connection-pool connection-creation-retry-interval-in-seconds="5" datasource-classname="oracle.jdbc.xa.client.OracleXADataSource" max-pool-size="200" max-connection-usage-count="1000" res-type="javax.sql.XADataSource" steady-pool-size="0" name="sss_pool" connection-creation-retry-attempts="5"&gt; &lt;property name="URL" value="jdbc:oracle:thin:@(DESCRIPTION =(ADDRESS_LIST =(ADDRESS = (PROTOCOL = TCP)(HOST = xxx.xxx.xxx.xxx)(PORT = xx)))(CONNECT_DATA =(SERVER = DEDICATED)(SERVICE_NAME = xx)))"&gt;&lt;/property&gt; &lt;property name="Password" value="***"&gt;&lt;/property&gt; &lt;property name="User" value="***"&gt;&lt;/property&gt; &lt;/jdbc-connection-pool&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload