ORACLE 11g + PHP5 problem: "fetch out of sequence" on remote database link

Hi!
I have a new server with oracle 11g (11.1.0.7) database and apache/php5 (actual build) on linux.
connection type is dedicated.
when doing a connection to a remote AS/400 database I always get this error:
"Warning: oci_fetch_array() http://function.oci-fetch-array: ORA-01002: fetch out of sequence ORA-02063: preceding line from..."
when doing the same simple "select * from database link" at my old server with oracle 9i and apache/php5 no problem occurrs.
this happens at AS/400 database link only. normal oracle database links work fine.
Anyone an idea how to solve this problem or where the problem is????
further info:
when doing " select * from [ database link ] where rownum < 11 " it works, but when doing the query with more than 10 results I get the error. Any idea?
bye,
Oliver
Edited by: user501548 on 10.10.2008 02:20

well a fetch out of sequence usually indicates that a cursor has been closed before the process has finished fetching or some such thing.
I'm not aware of there being a specific problem with the situation you outline, but maybe if you could provide all the connection setup and how you are trying to connect that may give a better idea.
Also, you may be better asking on the General Database Discussions forum as this isn't really a SQL or PL/SQL problem

Similar Messages

  • ORACLE 11g + PHP5 problem: "fetch out of sequence" on i5/OS AS/400

    Hi!
    I have a big problem using a database connection to i5 AS/400 with PHP5 OCI8 interface by Oracle 11g:
    when doing a simple "select * from (as400_database_link)" I get this return: "fetch out of sequence... preceding line..."
    I never had this problem with 9i, old transparent gateway.
    BUT:
    when doing for example a "select * from (as400_database_link) where rownum < 1000000" it works fine without problems.
    Anyone an idea how to eliminate this stupid "where rownum < 100000" behaviour?
    I would have to add this in many select statements... ;(
    bye,
    Oliver

    Tach,
    how do you call oci_execute ?
    try oci_execute($query,OCI_DEFAULT);
    I had the same problem with adodb
    $q = " select * from elephant@africa";
    $db->GetAll($q);
    Failed with the same error.
    ADODB called oci_execute with OCI_COMMIT_ON_SUCCESS,which caused my error.
    $q = " select * from elephant@africa";
    $db->BeginTrans();
    $db->GetAll($q);
    $db->CommitTrans(); (or rollback);
    did the job,because BeginTrans changed oci_execute to run with OCI_DEFAULT.
    Hope this helps,
    gw
    Edited by: unficyp123 on Oct 20, 2008 2:51 PM

  • ORA-01002/ Fetch out of sequence on lazy loading

    Hello,
    We are facing an oracle SQLException (ORA-01002: fetch out of sequence)
    while we are trying to get a field (retrieved via lazy loading) from an
    object that was retrieved using a kodoquery.
    This error only occurs during performance testing under a heavy load.
    (100 concurrent users). For each thread we get a new persistencemanager
    from the factory. And we have put the multithreaded option to true.
    Can anyone help us with this problem?
    Thanks in advance,
    Kind Regards,
    Niels Soeffers
    Caused by: java.sql.SQLException: ORA-01002: fetch out of sequence
         at
    oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:112)
         at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:331)
         at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:288)
         at oracle.jdbc.driver.T4C8Oall.receive(T4C8Oall.java:743)
         at
    oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4CPreparedStatement.java:216)
         at
    oracle.jdbc.driver.T4CPreparedStatement.fetch(T4CPreparedStatement.java:1027)
         at
    oracle.jdbc.driver.OracleResultSetImpl.close_or_fetch_from_next(OracleResultSetImpl.java:291)
         at
    oracle.jdbc.driver.OracleResultSetImpl.next(OracleResultSetImpl.java:213)
         at
    com.solarmetric.jdbc.DelegatingResultSet.next(DelegatingResultSet.java:97)
         at kodo.jdbc.sql.ResultSetResult.nextInternal(ResultSetResult.java:151)
         at kodo.jdbc.sql.AbstractResult.next(AbstractResult.java:123)
         at kodo.jdbc.sql.Select$SelectResult.next(Select.java:2236)
         at
    kodo.jdbc.meta.AbstractCollectionFieldMapping.load(AbstractCollectionFieldMapping.java:592)
         at kodo.jdbc.runtime.JDBCStoreManager.load(JDBCStoreManager.java:521)
         at
    kodo.runtime.DelegatingStoreManager.load(DelegatingStoreManager.java:133)
         at kodo.runtime.ROPStoreManager.load(ROPStoreManager.java:79)
         at kodo.runtime.StateManagerImpl.loadFields(StateManagerImpl.java:3166)
         at kodo.runtime.StateManagerImpl.loadField(StateManagerImpl.java:3265)
         at kodo.runtime.StateManagerImpl.isLoaded(StateManagerImpl.java:1386)
         at
    com.ardatis.ventouris.domain.OntvangstReeks.jdoGetontvangstTransacties(OntvangstReeks.java)
         at
    com.ardatis.ventouris.domain.OntvangstReeks.getStatus(OntvangstReeks.java:72)
         at
    com.ardatis.ventouris.service.financien.transfer.FinancienTOAssembler.getOntvangstReeksBaseTO(FinancienTOAssembler.java:71)
         at
    com.ardatis.ventouris.service.financien.transfer.FinancienTOAssembler.getOntvangstReeksBaseTOs(FinancienTOAssembler.java:84)
         at
    com.ardatis.ventouris.service.financien.FinancienManagerImpl.getOntvangstReeksBaseTOs(FinancienManagerImpl.java:241)
         at
    com.ardatis.ventouris.service.financien.ejb.FinancienManagerBean.getOntvangstReeksBaseTOs(FinancienManagerBean.java:62)
         at sun.reflect.GeneratedMethodAccessor181.invoke(Unknown Source)
         at
    sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:585)
         at com.sun.enterprise.security.SecurityUtil$2.run(SecurityUtil.java:153)
         at java.security.AccessController.doPrivileged(Native Method)
         at
    com.sun.enterprise.security.application.EJBSecurityManager.doAsPrivileged(EJBSecurityManager.java:950)
         at com.sun.enterprise.security.SecurityUtil.invoke(SecurityUtil.java:158)
         at
    com.sun.ejb.containers.EJBObjectInvocationHandler.invoke(EJBObjectInvocationHandler.java:128)
         at $Proxy31.getOntvangstReeksBaseTOs(Unknown Source)
         at sun.reflect.GeneratedMethodAccessor155.invoke(Unknown Source)
         at
    sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:585)
         at
    com.sun.corba.ee.impl.presentation.rmi.ReflectiveTie._invoke(ReflectiveTie.java:123)

    We are using Oracle 10g and have tried multiple dirvers. (classes12.jar,
    ojdbc14.jar)
    Our kodo.properties ( actually the ra.xml we supply with the kodo.rar )
    <connector>
    <display-name>KodoJDO</display-name>
    <description>Resource Adapter for integration of the Kodo Java Data
    Objects (JDO) implementation with J2EE 1.3 compliant managed
    environments</description>
    <vendor-name>Solarmetric, Inc.</vendor-name>
    <spec-version>1.0</spec-version>
    <eis-type>jdo</eis-type>
    <version>1.0</version>
    <license>
    <description>
    See http://www.solarmetric.com for terms and license conditions.
    </description>
    <license-required>true</license-required>
    </license>
    <resourceadapter>
         <managedconnectionfactory-class>kodo.jdbc.ee.JDBCManagedConnectionFactory</managedconnectionfactory-class>
    <connectionfactory-interface>javax.resource.cci.ConnectionFactory</connectionfactory-interface>
    <connectionfactory-impl-class>kodo.jdbc.ee.JDBCConnectionFactory</connectionfactory-impl-class>
    <connection-interface>javax.resource.cci.Connection</connection-interface>
    <connection-impl-class>kodo.runtime.PersistenceManagerImpl</connection-impl-class>
    <transaction-support>XATransaction</transaction-support>
    <config-property>
    <description>A comma-separated list of query aggregate listeners
    to add to the default list of extensions. Each listener must implement
    the kodo.jdbc.query.JDBCAggregateListener interface.</description>
    <config-property-name>AggregateListeners</config-property-name>
    <config-property-type>java.lang.String</config-property-type>
    <config-property-value></config-property-value>
    </config-property>
    <config-property>
    <description>The kodo.jdbc.meta.ClassIndicator to use by default
    for new mappings. The class indicator is responsible for tracking the
    concrete class or subclass implemented by the object stored in each row of
    a table.</description>
    <config-property-name>ClassIndicator</config-property-name>
    <config-property-type>java.lang.String</config-property-type>
    <config-property-value>in-class-name</config-property-value>
    </config-property>
    <config-property>
    <description>The kodo.util.ClassResolver implementation that
    should be used for JDO class resolution. Defaults to a JDO spec-compliant
    resolver.</description>
    <config-property-name>ClassResolver</config-property-name>
    <config-property-type>java.lang.String</config-property-type>
    <config-property-value>spec</config-property-value>
    </config-property>
    <config-property>
    <description>Details about various compatibiity levels for the
    current environment.</description>
    <config-property-name>Compatibility</config-property-name>
    <config-property-type>java.lang.String</config-property-type>
    <config-property-value>true</config-property-value>
    </config-property>
    <config-property>
    <description>The class name of either the JDBC java.sql.Driver, or
    an instance of a javax.sql.DataSource to use to connect to the non-XA data
    source.</description>
    <config-property-name>Connection2DriverName</config-property-name>
    <config-property-type>java.lang.String</config-property-type>
    <config-property-value></config-property-value>
    </config-property>
    <config-property>
    <description>The password for the user specified in
    Connection2UserName</description>
    <config-property-name>Connection2Password</config-property-name>
    <config-property-type>java.lang.String</config-property-type>
    <config-property-value></config-property-value>
    </config-property>
    <config-property>
    <description>A comma-separated list of properties to be passed to
    the non-XA JDBC Driver when obtaining a Connection. Properties are of the
    form "key=value". If the given JDBC Driver class is a DataSource, these
    properties will be used to configure the bean properties of the
    DataSource. </description>
    <config-property-name>Connection2Properties</config-property-name>
    <config-property-type>java.lang.String</config-property-type>
    <config-property-value></config-property-value>
    </config-property>
    <config-property>
    <description>The URL for the non-XA data source.</description>
    <config-property-name>Connection2URL</config-property-name>
    <config-property-type>java.lang.String</config-property-type>
    <config-property-value></config-property-value>
    </config-property>
    <config-property>
    <description>The username for the connection listed in
    Connection2URL.</description>
    <config-property-name>Connection2UserName</config-property-name>
    <config-property-type>java.lang.String</config-property-type>
    <config-property-value></config-property-value>
    </config-property>
    <config-property>
    <description>A comma-separated list of
    com.solarmetric.jdbc.ConnectionDecorator implementations to install on all
    connection pools.</description>
    <config-property-name>ConnectionDecorators</config-property-name>
    <config-property-type>java.lang.String</config-property-type>
    <config-property-value></config-property-value>
    </config-property>
    <config-property>
    <description>The class name of either the JDBC java.sql.Driver, or
    an instance of a javax.sql.DataSource to use to connect to the data
    source.</description>
    <config-property-name>ConnectionDriverName</config-property-name>
    <config-property-type>java.lang.String</config-property-type>
    <config-property-value></config-property-value>
    </config-property>
    <config-property>
    <description>The JNDI name of the connection factory to use for
    finding non-XA connections. If specified, this is the connection that
    will be used for obtaining sequence numbers.</description>
    <config-property-name>ConnectionFactory2Name</config-property-name>
    <config-property-type>java.lang.String</config-property-type>
         <config-property-value>jdbc/VentourisNonXA</config-property-value>
    </config-property>
    <config-property>
    <description>A comma-separated list of properties used to
    configure the javax.sql.DataSource used as the non-XA ConnectionFactory.
    Each property should be of the form "key=value", where "key" is the name
    of some bean-like property of the data source.</description>
    <config-property-name>ConnectionFactory2Properties</config-property-name>
    <config-property-type>java.lang.String</config-property-type>
    <config-property-value></config-property-value>
    </config-property>
    <config-property>
    <description>The JNDI name of the connection factory to use for
    obtaining connections.</description>
    <config-property-name>ConnectionFactoryName</config-property-name>
    <config-property-type>java.lang.String</config-property-type>
         <config-property-value>jdbc/Ventouris</config-property-value>
    </config-property>
    <config-property>
    <description>A comma-separated list of properties used to
    configure the javax.sql.DataSource used as the ConnectionFactory. Each
    property should be of the form "key=value", where "key" is the name of
    some bean-like property of the data source.</description>
    <config-property-name>ConnectionFactoryProperties</config-property-name>
    <config-property-type>java.lang.String</config-property-type>
    <config-property-value></config-property-value>
    </config-property>
    <config-property>
    <description>The password for the user specified in
    ConnectionUserName</description>
    <config-property-name>ConnectionPassword</config-property-name>
    <config-property-type>java.lang.String</config-property-type>
    <config-property-value></config-property-value>
    </config-property>
    <config-property>
    <description>A comma-separated list of properties to be passed to
    the JDBC Driver when obtaining a Connection. Properties are of the form
    "key=value". If the given JDBC Driver class is a DataSource, these
    properties will be used to configure the bean properties of the
    DataSource. </description>
    <config-property-name>ConnectionProperties</config-property-name>
    <config-property-type>java.lang.String</config-property-type>
    <config-property-value></config-property-value>
    </config-property>
    <config-property>
    <description>This property dictates when PersistenceManagers will
    retain and release data store connections. Available options are
    "on-demand" for retaining a connection only during pessimistic
    transactions and data store operations, "transaction" for retaining a
    connection for the life of each transaction, or "persistence-manager" to
    indicate that a persistence manager should retain and reuse a single
    connection for its entire lifespan.</description>
    <config-property-name>ConnectionRetainMode</config-property-name>
    <config-property-type>java.lang.String</config-property-type>
    <config-property-value>transaction</config-property-value>
    </config-property>
    <config-property>
    <description>The URL for the data source.</description>
    <config-property-name>ConnectionURL</config-property-name>
    <config-property-type>java.lang.String</config-property-type>
    <config-property-value></config-property-value>
    </config-property>
    <config-property>
    <description>The username for the connection listed in
    ConnectionURL.</description>
    <config-property-name>ConnectionUserName</config-property-name>
    <config-property-type>java.lang.String</config-property-type>
    <config-property-value></config-property-value>
    </config-property>
    <config-property>
    <description>Set to true if you''d like Kodo to copy all object
    ids before returning them to your code. If you do not plan on modifying
    identity objects, you can set this property to false to avoid the copying
    overhead.</description>
    <config-property-name>CopyObjectIds</config-property-name>
    <config-property-type>java.lang.Boolean</config-property-type>
    <config-property-value>false</config-property-value>
    </config-property>
    <config-property>
    <description>Plugin used to cache data loaded from the data store.
    Must implement kodo.datacache.DataCache.</description>
    <config-property-name>DataCache</config-property-name>
    <config-property-type>java.lang.String</config-property-type>
    <config-property-value></config-property-value>
    </config-property>
    <config-property>
    <description>The number of milliseconds that data in the data
    cache is valid for. A value of 0 or less means that by default, cached
    data does not time out.</description>
    <config-property-name>DataCacheTimeout</config-property-name>
    <config-property-type>java.lang.Integer</config-property-type>
    <config-property-value>-1</config-property-value>
    </config-property>
    <config-property>
    <description>The type of data source in use. Available options
    are "local" for a standard data source under Kodo''s control, or
    "enlisted" for a data source managed by an application server and
    automatically enlisted in global transactions.</description>
    <config-property-name>DataSourceMode</config-property-name>
    <config-property-type>java.lang.String</config-property-type>
    <config-property-value>enlisted</config-property-value>
    </config-property>
    <config-property>
    <description>The kodo.jdbc.sql.DBDictionary to use for database
    interaction. This is auto-detected based on the setting of
    javax.jdo.option.ConnectionURL, so you need only set this to override the
    default with your own custom dictionary or if you are using an
    unrecognized driver.</description>
    <config-property-name>DBDictionary</config-property-name>
    <config-property-type>java.lang.String</config-property-type>
    <config-property-value></config-property-value>
    </config-property>
    <config-property>
    <description>Whether to dynamically create custom structs to hold
    and transfer persistent state in the Kodo data cache and remote
    persistence manager frameworks. Dynamic structs can reduce data cache
    memory consumption, reduce the amount of data serialized back and forth
    under remote persistence managers, and improve the overall performance of
    these systems. However, they increase application warm-up time while the
    custom classes are generated and loaded into the JVM. Set to true to
    enable dynamic data structs.</description>
    <config-property-name>DynamicDataStructs</config-property-name>
    <config-property-type>java.lang.Boolean</config-property-type>
    <config-property-value>false</config-property-value>
    </config-property>
    <config-property>
    <description>Specifies the default eager fetch mode to use.
    Either "none" to never eagerly-load relations, "join" for selecting 1-1
    relations along with the target object using inner or outer joins, or
    "parallel" for selecting 1-1 relations via joins, and collections
    (including to-many relations) along with the target object using separate
    select statements executed in parallel.</description>
    <config-property-name>EagerFetchMode</config-property-name>
    <config-property-type>java.lang.String</config-property-type>
    <config-property-value>parallel</config-property-value>
    </config-property>
    <config-property>
    <description>The number of rows that will be pre-fetched when an
    element in a Query result is accessed. Use -1 to pre-fetch all
    results.</description>
    <config-property-name>FetchBatchSize</config-property-name>
    <config-property-type>java.lang.Integer</config-property-type>
    <config-property-value>-1</config-property-value>
    </config-property>
    <config-property>
    <description>The name of the JDBC fetch direction to use.
    Standard values are "forward", "reverse", and "unknown".</description>
    <config-property-name>FetchDirection</config-property-name>
    <config-property-type>java.lang.String</config-property-type>
    <config-property-value>forward</config-property-value>
    </config-property>
    <config-property>
    <description>A comma-separated list of fetch group names that
    PersistenceManagers will load by default when loading data from the data
    store.</description>
    <config-property-name>FetchGroups</config-property-name>
    <config-property-type>java.lang.String</config-property-type>
    <config-property-value></config-property-value>
    </config-property>
    <config-property>
    <description>A comma-separated list of query filter listeners to
    add to the default list of extensions. Each listener must implement the
    kodo.jdbc.query.JDBCFilterListener interface.</description>
    <config-property-name>FilterListeners</config-property-name>
    <config-property-type>java.lang.String</config-property-type>
    <config-property-value></config-property-value>
    </config-property>
    <config-property>
    <description>Whether or not Kodo should automatically flush
    modifications to the data store before executing queries.</description>
    <config-property-name>FlushBeforeQueries</config-property-name>
    <config-property-type>java.lang.String</config-property-type>
    <config-property-value>with-connection</config-property-value>
    </config-property>
    <config-property>
    <description>If true, Kodo will order all SQL inserts, updates,
    and deletes to meet your schema''s foreign key constraints. Defaults to
    false.</description>
    <config-property-name>ForeignKeyConstraints</config-property-name>
    <config-property-type>java.lang.Boolean</config-property-type>
    <config-property-value>false</config-property-value>
    </config-property>
    <config-property>
    <description>If false, then the JDO implementation must consider
    modifications, deletions, and additions in the PersistenceManager
    transaction cache when executing a query inside a transaction. Else, the
    implementation is free to ignore the cache and execute the query directly
    against the data store.</description>
    <config-property-name>IgnoreCache</config-property-name>
    <config-property-type>java.lang.Boolean</config-property-type>
    <config-property-value>true</config-property-value>
    </config-property>
    <config-property>
    <description>Plugin used to manage inverse relations during flush.
    Set to true to use the default inverse manager. Custom inverse managers
    must extend kodo.runtime.InverseManager.</description>
    <config-property-name>InverseManager</config-property-name>
    <config-property-type>java.lang.String</config-property-type>
    <config-property-value>false</config-property-value>
    </config-property>
    <config-property>
    <description>A comma-separated list of
    com.solarmetric.jdbc.JDBCListener implementations to install on all
    connection pools.</description>
    <config-property-name>JDBCListeners</config-property-name>
    <config-property-type>java.lang.String</config-property-type>
    <config-property-value></config-property-value>
    </config-property>
    <config-property>
    <description>The license key provided to you by SolarMetric. Keys
    are available at www.solarmetric.com</description>
    <config-property-name>LicenseKey</config-property-name>
    <config-property-type>java.lang.String</config-property-type>
    <config-property-value><KEY-REMOVED></config-property-value>
    </config-property>
    <config-property>
    <description>Plugin used to handle acquiring locks on persistent
    instances. Must implement kodo.runtime.LockManager.</description>
    <config-property-name>LockManager</config-property-name>
    <config-property-type>java.lang.String</config-property-type>
    <config-property-value>pessimistic</config-property-value>
    </config-property>
    <config-property>
    <description>The number of milliseconds to wait for an object lock
    before throwing an exception, or -1 for no limit.</description>
    <config-property-name>LockTimeout</config-property-name>
    <config-property-type>java.lang.Integer</config-property-type>
    <config-property-value>-1</config-property-value>
    </config-property>
    <config-property>
    <description>LogFactory and configuration for Kodo''s logging
    needs.</description>
    <config-property-name>Log</config-property-name>
    <config-property-type>java.lang.String</config-property-type>
    <config-property-value>kodo(DefaultLevel=WARN, Tool=WARN,
    Runtime=WARN, SQL=WARN)</config-property-value>
    </config-property>
    <config-property>
    <description>The mode to use for calculating the size of large
    result sets. Legal values are "unknown", "last", and "query".</description>
    <config-property-name>LRSSize</config-property-name>
    <config-property-type>java.lang.String</config-property-type>
    <config-property-value>query</config-property-value>
    </config-property>
    <config-property>
    <description>Plugin used to integrate with an external transaction
    manager. Must implement kodo.runtime.ManagedRuntime.</description>
    <config-property-name>ManagedRuntime</config-property-name>
    <config-property-type>java.lang.String</config-property-type>
    <config-property-value>auto</config-property-value>
    </config-property>
    <config-property>
    <description>Plugin used to configure management and profiling
    capabilities.</description>
    <config-property-name>ManagementConfiguration</config-property-name>
    <config-property-type>java.lang.String</config-property-type>
    <config-property-value>none</config-property-value>
    </config-property>
    <config-property>
    <description>The kodo.jdbc.meta.MappingFactory that will provide
    the object-relational mapping information needed to map each persistent
    class to the database.</description>
    <config-property-name>MappingFactory</config-property-name>
    <config-property-type>java.lang.String</config-property-type>
    <config-property-value>file</config-property-value>
    </config-property>
    <config-property>
    <description>Plugin used to create metadata about persistent
    types. Must implement kodo.meta.MetaDataLoader</description>
    <config-property-name>MetaDataLoader</config-property-name>
    <config-property-type>java.lang.String</config-property-type>
    <config-property-value>jdo</config-property-value>
    </config-property>
    <config-property>
    <description>If true, then the application plans to have multiple
    threads simultaneously accessing a single PersistenceManager, so measures
    must be taken to ensure that the implementation is thread-safe. Otherwise,
    the implementation need not address thread safety.</description>
    <config-property-name>Multithreaded</config-property-name>
    <config-property-type>java.lang.Boolean</config-property-type>
    <config-property-value>true</config-property-value>
    </config-property>
    <config-property>
    <description>If true, then it is possible to read persistent data
    outside the context of a transaction. Otherwise, a transaction must be in
    progress in order read data.</description>
    <config-property-name>NontransactionalRead</config-property-name>
    <config-property-type>java.lang.Boolean</config-property-type>
    <config-property-value>true</config-property-value>
    </config-property>
    <config-property>
    <description>If true, then it is possible to write to fields of a
    persistent-nontransactional object when a transaction is not in progress.
    If false, such a write will result in a JDOUserException.</description>
    <config-property-name>NontransactionalWrite</config-property-name>
    <config-property-type>java.lang.Boolean</config-property-type>
    <config-property-value>false</config-property-value>
    </config-property>
    <config-property>
    <description>Determines the persistence manager's behavior in
    calls to getObjectById with a validate parameter of false. Use "check" to
    check that a database record exists for the object and load its fetch
    group fields. Use "hollow" to return a hollow instance.</description>
    <config-property-name>ObjectLookupMode</config-property-name>
    <config-property-type>java.lang.String</config-property-type>
    <config-property-value>check</config-property-value>
    </config-property>
    <config-property>
    <description>Selects between optimistic and pessimistic (data
    store) transactional modes.</description>
    <config-property-name>Optimistic</config-property-name>
    <config-property-type>java.lang.Boolean</config-property-type>
    <config-property-value>true</config-property-value>
    </config-property>
    <config-property>
    <description>Action to take when Kodo discovers an orphaned key in
    the database. May be a custom action implementing
    kodo.event.OrphanedKeyAction.</description>
    <config-property-name>OrphanedKeyAction</config-property-name>
    <config-property-type>java.lang.String</config-property-type>
    <config-property-value>log</config-property-value>
    </config-property>
    <config-property>
    <description>The name of the concrete implementation of
    javax.jdo.PersistenceManagerFactory that
    javax.jdo.JDOHelper.getPersistenceManagerFactory () should create. For
    Kodo JDO, this should be kodo.jdbc.runtime.JDBCPersistenceManagerFactory
    or a custom extension of this type.</description>
    <config-property-name>PersistenceManagerFactoryClass</config-property-name>
    <config-property-type>java.lang.String</config-property-type>
    <config-property-value>kodo.jdbc.runtime.JDBCPersistenceManagerFactory</config-property-value>
    </config-property>
    <config-property>
    <description>Persistence manager plugin and properties. If you
    use a custom class, it must extend
    kodo.runtime.PersistenceManagerImpl.</description>
    <config-property-name>PersistenceManagerImpl</config-property-name>
    <config-property-type>java.lang.String</config-property-type>
    <config-property-value>default</config-property-value>
    </config-property>
    <config-property>
    <description>Configure this persistence manager factory to service
    remote persistence managers.</description>
    <config-property-name>PersistenceManagerServer</config-property-name>
    <config-property-type>java.lang.String</config-property-type>
    <config-property-value>false</config-property-value>
    </config-property>
    <config-property>
    <description>A comma-separated list of the class names of all
    persistent classes to register whenever a persistence manager is
    obtained.</description>
    <config-property-name>PersistentClasses</config-property-name>
    <config-property-type>java.lang.String</config-property-type>
    <config-property-value>com.ardatis.ventouris.domain.KwartaalVerhoging,
    com.ardatis.ventouris.domain.Land, com.ardatis.ventouris.domain.Gemeente,
    com.ardatis.ventouris.domain.Adres,
    com.ardatis.ventouris.domain.ContactGegeven,
    com.ardatis.ventouris.domain.AdresContactGegeven,
    com.ardatis.ventouris.common.type.AdresType,
    com.ardatis.ventouris.domain.OntvangstTransactie,
    com.ardatis.ventouris.domain.OntvangstReeks,
    com.ardatis.ventouris.domain.Ontvangst,
    com.ardatis.ventouris.domain.Inkomen,
    com.ardatis.ventouris.domain.loopbaan.LoopbaanPeriode,
    com.ardatis.ventouris.common.type.InkomenSoort,
    com.ardatis.ventouris.common.type.INSZ,
    com.ardatis.ventouris.domain.Aangeslotene,
    com.ardatis.ventouris.domain.NatuurlijkePersoon,
    com.ardatis.ventouris.domain.Persoon, com.ardatis.ventouris.domain.Rol,
    com.ardatis.ventouris.domain.Dossier,
    com.ardatis.ventouris.common.type.Geslacht,
    com.ardatis.ventouris.common.type.Taal,
    com.ardatis.ventouris.common.type.Nationaliteit,
    com.ardatis.ventouris.common.type.KostType,
    com.ardatis.ventouris.domain.Verhoging,
    com.ardatis.ventouris.domain.Aanvraag,
    com.ardatis.ventouris.domain.AanvraagAansluitingSS,
    com.ardatis.ventouris.domain.AanvraagToestand,
    com.ardatis.ventouris.common.type.AanvraagToestandType,
    com.ardatis.ventouris.domain.Factuur,
    com.ardatis.ventouris.domain.TaakType, com.ardatis.ventouris.domain.Taak,
    com.ardatis.ventouris.domain.BijdrageBerekening,
    com.ardatis.ventouris.domain.calculationparameters.HerwaarderingsIndex,
    com.ardatis.ventouris.domain.integration.asis.TempInterneOntvangst,
    com.ardatis.ventouris.domain.calculationparameters.InkomenGrens,
    com.ardatis.ventouris.domain.calculationparameters.BijdrageCategorie,
    com.ardatis.ventouris.domain.calculationparameters.BijdrageCategorieGroep,
    com.ardatis.ventouris.domain.integration.asis.TempOntvangstKinderbijslag,
    com.ardatis.ventouris.domain.calculationparameters.JaarVerhogingParameter,
    com.ardatis.ventouris.domain.calculationparameters.KwartaalVerhogingParameter,
    com.ardatis.ventouris.domain.UitgaveReeks,
    com.ardatis.ventouris.domain.Uitgave,
    com.ardatis.ventouris.domain.Terugbetaling,
    com.ardatis.ventouris.domain.BedragTerugbetaald,
    com.ardatis.ventouris.domain.BijdrageSS</config-property-value>
    </config-property>
    <config-property>
    <description>Plugin used to proxy second class object fields of
    managed instances. Must implement kodo.util.ProxyManager.</description>
    <config-property-name>ProxyManager</config-property-name>
    <config-property-type>java.lang.String</config-property-type>
    <config-property-value>default</config-property-value>
    </config-property>
    <config-property>
    <description>Plugin used to cache query results loaded from the
    data store. Must implement kodo.datacache.QueryCache.</description>
    <config-property-name>QueryCache</config-property-name>
    <config-property-type>java.lang.String</config-property-type>
    <config-property-value>true</config-property-value>
    </config-property>
    <config-property>
    <description>Plugin used to cache query compilation data. Must
    implement java.util.Map. Does not need to be thread-safe -- it will be
    wrapped via the Collections.synchronizedMap() method if it does not extend
    kodo.util.CacheMap.</description>
    <config-property-name>QueryCompilationCache</config-property-name>
    <config-property-type>java.lang.String</config-property-type>
    <config-property-value>true</config-property-value>
    </config-property>
    <config-property>
    <description>The default lock level to use when loading objects
    within non-optimistic transactions. Set to none, read, write, or the
    numeric value of the desired lock level for your lock
    manager.</description>
    <config-property-name>ReadLockLevel</config-property-name>
    <config-property-type>java.lang.String</config-property-type>
    <config-property-value>read</config-property-value>
    </config-property>
    <config-property>
    <description>Plugin used to communicate commit information among
    JVMs. Must implement kodo.event.RemoteCommitProvider.</description>
    <config-property-name>RemoteCommitProvider</config-property-name>
    <config-property-type>java.lang.String</config-property-type>
    <config-property-value></config-property-value>
    </config-property>
    <config-property>
    <description>Whether or not RemoteCommitEvents will include the
    object Ids of objects added during the transaction.</description>
    <config-property-name>RemoteCommitTransmitAddObjectIds</config-property-na

  • Fetch out of sequence ERROR - urgent

    Hi guys ..
    If i try to run the program i am getting an error message as
    java.sql.SQLException: ORA-01002: fetch out of sequence at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:169)
    will u pl help me how to solve this
    import java.sql.*;
    import oracle.sql.*;
    import oracle.jdbc.driver.*;
    import java.io.*;
    class LOBTest
         public static void main(String str[])
              try
                   DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
                   Connection con = DriverManager.getConnection("jdbc:oracle:thin:spk/[email protected]:1521:spk");
                   Statement stmt = con.createStatement();
                   ResultSet rs = stmt.executeQuery("select temp from blobtest where no = 1 for update");
                   BLOB bl = null;
                   if(rs.next())
                        bl = ((OracleResultSet)rs).getBLOB(1);
                             FileInputStream ins = new FileInputStream("map.gif");
                             byte br[]= new byte[ins.available()];
                             ins.read(br);
                             bl.putBytes(0,br);
              }catch(Exception ept)
                   ept.printStackTrace();
                   System.out.println(ept);
    }

    from the Oracle docs:
    "ORA-01002: fetch out of sequence
    Cause: In a host language program, a FETCH call was issued out of sequence. A successful parse-and-execute call must be issued before a fetch. This can occur if an attempt was made to FETCH from an active set after all records have been fetched. This may be caused by fetching from a SELECT FOR UPDATE cursor after a commit. A PL/SQL cursor loop implicitly does fetches and may also cause this error.
    Action: Parse and execute a SQL statement before attempting to fetch the data. "
    taken from:
    http://technet.oracle.com/doc/server.804/a58312/newch221.htm#16189
    Solution:
    when you use "for update" in your select statement you must set the connection's auto commit to false--> Connection.setAutoCommit(false);
    Jamie

  • Oracle Report raises ORA-01002 Fetch out of sequence

    ORA-01002 Fetch out of sequence in runtime execution of
    oracle report 3.0 and 2.5 in client/server environment.
    The same sql query works in sqlplus without any problem.
    If I change the criteria (where clause) the error sometime
    disappear. I can't explain this weird behaviour.
    Oracle server version is 7.1.5 on Digital VMS.
    Any Help will be welcome.
    null

    ORA-01002 Fetch out of sequence in runtime execution of
    oracle report 3.0 and 2.5 in client/server environment.
    The same sql query works in sqlplus without any problem.
    If I change the criteria (where clause) the error sometime
    disappear. I can't explain this weird behaviour.
    Oracle server version is 7.1.5 on Digital VMS.
    Any Help will be welcome.
    null

  • Fetch out of Sequence after upgrade oracle 11

    Hi,
    Since we are updating our customers from oracle 8,9 or 10 to oracle 11, we get the error ORA-01002 'fetch out of sequence' alot.
    There is nothing changed in the database structure or our programming and it occurs on different tables.
    The only thing we've noticed is, if we use a oracle client 10 on oracle 11 database we don't have the problem.
    Is there a problem with the oracle 11 client or another solution that prevent the error.
    The option to install an oracle 10 client with every customer is not a solution
    because we don't manage every database of our customer but we have to work with it.
    Thx in advance!
    Friendly regards,
    Gregor

    Indeed we find it also a weird problem, but it is growing problem because more of our customors are updating to oracle 11.
    And we find it also difficult to believe it depends on the client software.
    Could it be a database userrights problem that is changed a little bit in the oracle 11? Because we see its a problem between tables from different users.
    We didn't change anything with a upgrade to oracle 11.

  • ORA-01002: fetch out of sequence- error when accesing oracle sp from c#

    We have a stored procedure when we exceute it from Sql plus tool ot Toad works fine. But when we call it from C# .ne code gives us the following error.
    ORA-01002: fetch out of sequence ORA-02063: preceding line from SQA1
    Please help.

    with out these lines it works
    (fae_primary_agent_ind = 'X') or
    ((fae_primary_agent_ind is null) and (agn_agt_comp_st_cd = ‘65’)
    This is the stored proc. It works in oracle. It does not work only when we call it from C#.
    CREATE OR REPLACE
    PROCEDURE abc (
    p_report_date IN VARCHAR2,
    p_cur OUT Getadrdata.t_cursor,
    p_run_mode OUT NUMBER
    AS
    v_report_dt DATE;
    backed_out NUMBER := 0;
    previously_paid NUMBER := 0;
    BEGIN
    v_report_dt := TO_DATE (p_report_date, 'DDMMYYYY');
    SELECT COUNT (*)
    INTO backed_out
    FROM r2t_adr_payment a, DUAL
    WHERE a.fap_acctg_dt = v_report_dt
    AND a.fap_status_cd = 'B';
    IF backed_out = 0
    THEN
         SELECT COUNT (*)
    INTO previously_paid
    FROM r2t_adr_payment a, DUAL
    WHERE a.fap_acctg_dt = v_report_dt
    AND a.fap_status_cd = 'P';
    END IF;
    IF backed_out > 0 or previously_paid > 0
    THEN
    p_run_mode := 2;
    OPEN p_cur FOR
    SELECT fae_agent_nbr agent_nbr, fae_ssn_last_4digits ssn_nbr,
    fae_address_ln1 address_line1, fae_address_ln2 address_line2,
    fae_city_nm city, fae_state_cd state, fae_zip_cd zip,
    fae_bus_phone business_phone, fae_supv_region_cd region,
    fae_territory_cd territory, fae_market_cd market,
    -- FAE_AGT_COMP_ST_CD COMP_STAT_CD,
    agn_agt_comp_st_cd comp_stat_cd, fae_emplmt_dt emp_date,
    fae_agent_type_cd status_cd, fae_first_nm first_name,
    fae_last_nm last_name,
    rpt_agent_bonus_class_id p_agent_bonus_class_id
    FROM r2t_adr_epc_agent_info LEFT OUTER JOIN rgt_points
    ON fae_agent_nbr = rpt_agent_nbr
    LEFT OUTER JOIN p1t_tot_agent ON fae_agent_nbr =
    agn_agent_nbr
    INNER JOIN r2t_adr_payment
    ON fae_agent_nbr = fap_primary_agent_nbr
    WHERE FAE_AGENT_TYPE_CD = '41'
    AND rpt_acctg_dt = v_report_dt
    AND v_report_dt BETWEEN agn_start_eff_dt AND agn_end_eff_dt
    AND fap_acctg_dt = v_report_dt
    AND fap_status_cd = 'B'
    UNION ALL
    SELECT fae_agent_nbr agent_nbr, fae_ssn_last_4digits ssn_nbr,
    fae_address_ln1 address_line1, fae_address_ln2 address_line2,
    fae_city_nm city, fae_state_cd state, fae_zip_cd zip,
    fae_bus_phone business_phone, fae_supv_region_cd region,
    fae_territory_cd territory, fae_market_cd market,
    -- FAE_AGT_COMP_ST_CD COMP_STAT_CD,
    agn_agt_comp_st_cd comp_stat_cd, fae_emplmt_dt emp_date,
    fae_agent_type_cd status_cd, fae_first_nm first_name,
    fae_last_nm last_name,
    0 p_agent_bonus_class_id
    FROM r2t_adr_epc_agent_info
    LEFT OUTER JOIN p1t_tot_agent ON fae_agent_nbr =
    agn_agent_nbr
    INNER JOIN r2t_adr_payment
    ON fae_agent_nbr = fap_primary_agent_nbr
    WHERE fae_agent_type_cd = '13'
    AND v_report_dt BETWEEN agn_start_eff_dt AND agn_end_eff_dt
    AND fap_acctg_dt = v_report_dt
    AND fap_status_cd = 'B';
    ELSE
    p_run_mode := 1;
    OPEN p_cur FOR
    SELECT fae_agent_nbr agent_nbr, fae_ssn_last_4digits ssn_nbr,
    fae_address_ln1 address_line1, fae_address_ln2 address_line2,
    fae_city_nm city, fae_state_cd state, fae_zip_cd zip,
    fae_bus_phone business_phone, fae_supv_region_cd region,
    fae_territory_cd territory, fae_market_cd market,
    -- FAE_AGT_COMP_ST_CD COMP_STAT_CD,
    agn_agt_comp_st_cd comp_stat_cd, fae_emplmt_dt emp_date,
    fae_agent_type_cd status_cd, fae_first_nm first_name,
    fae_last_nm last_name,
    rpt_agent_bonus_class_id p_agent_bonus_class_id
    FROM r2t_adr_epc_agent_info LEFT OUTER JOIN rgt_points
    ON fae_agent_nbr = rpt_agent_nbr
    LEFT OUTER JOIN p1t_tot_agent ON fae_agent_nbr =
    agn_agent_nbr
    WHERE rpt_acctg_dt = v_report_dt
    -- Next line for testing of a subset of data - testing purposes only
    -- AND FAE_SUPV_REGION_CD ='002'
    AND FAE_AGENT_TYPE_CD = '41'
    AND (
    (RPT_AGENT_BONUS_CLASS_ID = '3' AND SUBSTR(FAE_EMPLMT_DT,1,2) <> '01' AND ADD_MONTHS(FAE_EMPLMT_DT, 7 ) <= v_report_dt) OR
    (RPT_AGENT_BONUS_CLASS_ID = '3' AND SUBSTR(FAE_EMPLMT_DT,1,2) = '01' AND ADD_MONTHS(FAE_EMPLMT_DT, 6 ) <= v_report_dt) OR
    (RPT_AGENT_BONUS_CLASS_ID = '1')
    AND (
    (fae_primary_agent_ind = 'X') or
    ((fae_primary_agent_ind is null) and (agn_agt_comp_st_cd = ‘65’)
    AND v_report_dt BETWEEN agn_start_eff_dt AND agn_end_eff_dt
    UNION ALL
    SELECT fae_agent_nbr agent_nbr, fae_ssn_last_4digits ssn_nbr,
    fae_address_ln1 address_line1, fae_address_ln2 address_line2,
    fae_city_nm city, fae_state_cd state, fae_zip_cd zip,
    fae_bus_phone business_phone, fae_supv_region_cd region,
    fae_territory_cd territory, fae_market_cd market,
    -- FAE_AGT_COMP_ST_CD COMP_STAT_CD,
    agn_agt_comp_st_cd comp_stat_cd, fae_emplmt_dt emp_date,
    fae_agent_type_cd status_cd, fae_first_nm first_name,
    fae_last_nm last_name, 0 p_agent_bonus_class_id
    FROM r2t_adr_epc_agent_info LEFT OUTER JOIN p1t_tot_agent
    ON fae_agent_nbr = agn_agent_nbr
    WHERE fae_agent_type_cd = '13'
    -- Next line for testing of a subset of data - testing purposes only
    -- AND FAE_SUPV_REGION_CD ='002'
    AND fae_primary_agent_ind = 'X'
    AND v_report_dt BETWEEN agn_start_eff_dt AND agn_end_eff_dt;
    END IF;
    EXCEPTION
    WHEN NO_DATA_FOUND
    THEN
    --DBMS_OUTPUT.PUT_LINE ('no data ' || SQLERRM);
    NULL;
    WHEN OTHERS
    THEN
    --DBMS_OUTPUT.PUT_LINE ('error ' || SQLERRM);
    --OPEN p_cur FOR
    -- SELECT NULL
    -- FROM DUAL;
              RAISE;
    END abc;

  • Update table with BC4J results in ORA-1002: fetch out of sequence

    In our BC4J application, any table updates result in an ORA-1002: fetch out of sequence error message. The code looks something like this:
    EmpViewImpl voEmp = getEmpView ();
    voEmp.setWhereClause ("id = :0");
    voEmp.setWhereClauseParam (0, iEmpId);
    voEmp.executeQuery ();
    if (voEmp.hasNext ()) {
    EmpViewRowImpl rowEmp = (EmpViewRowImpl) voEmp.first ();
    rowEmp.setFirstName ("Larry");
    getTransaction ().postChanges ();
    getTransaction ().commit ();
    This has something to do with a bug (according to the Oracle JVM release notes). Still, this is fairly basic BC4J code, copied straight from the BC4J documentation. So why won't it work? Is there a workaround?
    I'm currently replacing all this code with straightforward executeCommand ("update emp set firstname='.......") commands. This isn't problem-free either, because the remaining BC4J-code isn't always directly aware of any changes made in the database this way.
    We use Oracle 8.1.6.1.0 on Linux RedHat 6.2, and JDeveloper 3.1 on Windows 2000. We've deployed the BC4J application modules as EJB's into the Oracle 8i JVM.
    Any help is much appreciated!!!

    We've got the exact same problem!
    Please help us....

  • ORA-01002: fetch out of sequence! HELP NEEDED!

    Hi, can someone help us (me)!
    Application: Sun-ConcordeXAL 2.6
    Clients: Sun-Oracle-7.2.3
    Database: Linux-Oracle-8.0.5.1
    (PS! if clients software change to XAL 2.7 and Oracle 8.0.4
    then we get same error)
    Maybe database configuration or client oracle configuration
    problem we dont'no ...
    HELP US(Me)
    Andri
    null

    Andri Karniol (guest) wrote:
    : Hi, can someone help us (me)!
    : Application: Sun-ConcordeXAL 2.6
    : Clients: Sun-Oracle-7.2.3
    : Database: Linux-Oracle-8.0.5.1
    : (PS! if clients software change to XAL 2.7 and Oracle 8.0.4
    : then we get same error)
    : Maybe database configuration or client oracle configuration
    : problem we dont'no ...
    : HELP US(Me)
    : Andri
    I met the same error message when I upgrade the database from
    SCO-7.2.2.4 to Sun-7.3.4. It seems some Pro*C program can not
    work anymore. It give me ORA-01002: fetch out of sequence.
    Any idea in this case?
    Rgds Johnny
    null

  • ORA-01002: fetch out of sequence using multiple XA datasources

    Hi,
    I have a problem accessing multiple XA datasources :
    - launch an sql request on datasource 1
    - rs.next() on the resultset
    - use the data to launch another sql request on datasource 2
    After 10 iterations, the next() method throws an SQLException (ORA-01002: fetch out of sequence).
    After further investigation, I noticed that :
    - the problem doesn't occur if the same datasource is used for the 2 requests
    - if I set the fetch size to 15 for the first request, the exception is thrown after 15 iterations (but I can't use this as a workaround because the number is potentially above the million).
    Anyone experiencing the same problem ?
    Thanks in advance
    Nicolas
    Here's my configuration :
    - Weblogic 8.1 SP4
    - JDK sun 1.4.2_04 (we have the same problem with various JDKs including JRockit)
    - Oracle 10g
    - Oracle thin driver xa 10.1.0.2.0
    A JSP I use to reproduce the problem :
    <pre><%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%>
    <%@ page import="java.util.ArrayList,
                        java.sql.Connection,
                        java.sql.PreparedStatement,
                        java.sql.ResultSet,
                        java.sql.SQLException,
                        javax.naming.InitialContext,
                        javax.naming.NamingException,
                        javax.sql.DataSource,
                        javax.transaction.UserTransaction"%>
    <%!
         public void launchTest() throws Exception {
              Connection cnx =null ;
              try {
                   getUserTransaction().begin();
                   // SQL access #1
                   cnx = getConnection("jdbc/xaDatasource1");
                   PreparedStatement stmt = cnx.prepareStatement("SELECT test_col from test_table");
                   ResultSet rs = stmt.executeQuery();
                   // iterate on resulset from SQL 1
                   int i=1;
                   while (rs.next()){ // SQL exception after 10 iterations
                        System.out.println(i + "");
                        i++;
                        // SQL access #2
                        Connection cnx2 = getConnection("jdbc/xaDatasource2");
                        // problem occurs even if we don't request
                        cnx2.close();
                        // end SQL access #2
                   getUserTransaction().commit();
              } catch (Exception e) {
                   e.printStackTrace();
                   try {
                        getUserTransaction().rollback();
                   } catch (Exception e1) {
                        e1.printStackTrace();
                        throw e;
              } finally {
                   try {
                        if (cnx != null && !cnx.isClosed())
                             cnx.close();
                   } catch (Exception e1) {
                        e1.printStackTrace();
         private UserTransaction getUserTransaction() throws NamingException {
              return (UserTransaction) new InitialContext().lookup("java:comp/UserTransaction");
         private Connection getConnection(String jndiName) throws NamingException, SQLException {
              DataSource ds = (DataSource) new InitialContext().lookup(jndiName);
              return ds.getConnection();
    %>
    <%
    launchTest();
         SQL CODE :
         CREATE TABLE TEST_TABLE (     TEST_COL NUMBER(2));
         insert into test_table values(1);
         insert into test_table values(2);
         insert into test_table values(3);
         insert into test_table values(4);
         insert into test_table values(5);
         insert into test_table values(6);
         insert into test_table values(7);
         insert into test_table values(8);
         insert into test_table values(9);
         insert into test_table values(10);
         insert into test_table values(11);
    %>
    </pre>

    Nicolas Mervaillie wrote:
    Hi,
    I have a problem accessing multiple XA datasources :
    - launch an sql request on datasource 1
    - rs.next() on the resultset
    - use the data to launch another sql request on datasource 2
    After 10 iterations, the next() method throws an SQLException (ORA-01002: fetch out of sequence).
    After further investigation, I noticed that :
    - the problem doesn't occur if the same datasource is used for the 2 requests
    - if I set the fetch size to 15 for the first request, the exception is thrown after 15 iterations (but I can't use this as a workaround because the number is potentially above the million).
    Anyone experiencing the same problem ?Hi. This is a known weakness of Oracle. If the XA transactional context of a connection
    changes during a result set processing, even if it is switched back correctly, the result
    set is aborted. If the oracle driver has fetched 10 rows, that's all you get. The next
    call to next() that needs real DBMS communication will fail.
    By spec, an XA connection should be able to be swapped out and enlisted in different
    transactions at a per-call granularity, so our pools allow that by default. Try setting
    the KeepXAConnTillTxCOmplete setting in your pool.
    When a connection is put back in the pool, if it is an XA connection we will suspend
    any user tx, and test it with our own test tx, then re-enlist and re-start the user
    tx in flight. This may be the context switch that kills the oracle result set.
    Joe
    >
    Thanks in advance
    Nicolas
    Here's my configuration :
    - Weblogic 8.1 SP4
    - JDK sun 1.4.2_04 (we have the same problem with various JDKs including JRockit)
    - Oracle 10g
    - Oracle thin driver xa 10.1.0.2.0
    A JSP I use to reproduce the problem :
    <pre><%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%>
    <%@ page import="java.util.ArrayList,
                        java.sql.Connection,
                        java.sql.PreparedStatement,
                        java.sql.ResultSet,
                        java.sql.SQLException,
                        javax.naming.InitialContext,
                        javax.naming.NamingException,
                        javax.sql.DataSource,
                        javax.transaction.UserTransaction"%>
    <%!
         public void launchTest() throws Exception {
              Connection cnx =null ;
              try {
                   getUserTransaction().begin();
                   // SQL access #1
                   cnx = getConnection("jdbc/xaDatasource1");
                   PreparedStatement stmt = cnx.prepareStatement("SELECT test_col from test_table");
                   ResultSet rs = stmt.executeQuery();
                   // iterate on resulset from SQL 1
                   int i=1;
                   while (rs.next()){ // SQL exception after 10 iterations
                        System.out.println(i + "");
                        i++;
                        // SQL access #2
                        Connection cnx2 = getConnection("jdbc/xaDatasource2");
                        // problem occurs even if we don't request
                        cnx2.close();
                        // end SQL access #2
                   getUserTransaction().commit();
              } catch (Exception e) {
                   e.printStackTrace();
                   try {
                        getUserTransaction().rollback();
                   } catch (Exception e1) {
                        e1.printStackTrace();
                        throw e;
              } finally {
                   try {
                        if (cnx != null && !cnx.isClosed())
                             cnx.close();
                   } catch (Exception e1) {
                        e1.printStackTrace();
         private UserTransaction getUserTransaction() throws NamingException {
              return (UserTransaction) new InitialContext().lookup("java:comp/UserTransaction");
         private Connection getConnection(String jndiName) throws NamingException, SQLException {
              DataSource ds = (DataSource) new InitialContext().lookup(jndiName);
              return ds.getConnection();
    %>
    <%
    launchTest();
         SQL CODE :
         CREATE TABLE TEST_TABLE (     TEST_COL NUMBER(2));
         insert into test_table values(1);
         insert into test_table values(2);
         insert into test_table values(3);
         insert into test_table values(4);
         insert into test_table values(5);
         insert into test_table values(6);
         insert into test_table values(7);
         insert into test_table values(8);
         insert into test_table values(9);
         insert into test_table values(10);
         insert into test_table values(11);
    %>
    </pre>

  • ORA-01002 fetch out of sequence after suspend/resume transaction

    Environment
    - WebLogic 10.0.2.0
    - Oracle thin driver 10.2.0.2.0
    I iterate throw elements of ResultSet. During that global transaction is suspended and resumed. Then invoking of next on ResultSet caused following exception “java.sql.SQLException: ORA-01002: fetch out of sequence”.
    I found that similar problem was reported in older WLS version ORA-01002 fetch out of sequence
    Do you have any idea how I can fix it?
    Best regards,
    Adam

    OK, to get to the complete explanation, I suggest you open
    an official support case. And I'm not trying to avoid the issue,
    but fetching millions of rows out of the database to process
    them outside is the wrong way to go. I highly recommend
    DBMS-side logic in stored procedures to do the raw data processing.

  • Fetch out of sequence

    when I run report (report2.5) in C/S structure,soemtime I meet ORA-01002 : fetch ut of sequence problem, I go to another pc and try to run same report, It will not happen. Who can help me?
    Is it a problem of report programing or client PC setup or Database configure or even a reports 2.5 bugger?
    My environemnt:
    server : Window NT 4.0+sp5 HP lh6000 server
    client: Windows 95 Pentinum II/III PC
    databse: Oracle 8.0.4.3 enterprise edition
    Application : DEvelop2000 v1.5( forms V4.5, Reports V2.5)

    I seemed to be missing the initial portion of this discussion BUT
    it has been my experience that a Fetch out of sequence can be
    caused by:
    specifying a cursor with the FOR UPDATE statement,
    committing data, and then
    trying to fetch again.
    Frank Huether (guest) wrote:
    : Elbasheer (guest) wrote:
    : : Reports 2.5 and 3.0 sqlnet2.3 and even 8 , database 7.3.4.
    : The
    : : client is win95. Database reside on HP-UX 10.20. NonBlocksql
    : is
    : : taken_care_of. I did everything. I wish if I could get the
    : : source code for the reports to fix it myself.
    : Also reduce the array size.
    : Frank
    null

  • ORA-01002 fetch out of sequence issue

    Hi,
    I am facing a weird ORA-01002 issue where I am passing the payload by opening a cursor to a separate package which has the merge statement. This fails with ORA-01002 error when there are multiple updates for a single record on target. I read through the Oracle documentation which states "MERGE is a deterministic statement. That is, you cannot update the same row of the target table multiple times in the same MERGE statement."
    My use case is such that there can be multiple updates in a day for an account and I have to maintain history for this on the target and I have a merge to do this. I am implementing SCD using triggers. What do you guys suggest to implement this solution? I need to update the same target table record multiple times in the same MERGE statement.
    Calling procedure:
    declare
    acct load_<package>.account_list;
    begin
    OPEN acct FOR
            SELECT DISTINCT<cols>
          FROM <table> where action_type='UPDATE' order by account_updatedate;
            load_<package>.<proc>(acct);
        CLOSE acct;
    end;
    Merge package/procedure:
    PROCEDURE merge_<proc(acct IN account_list)
      AS
      BEGIN
        MERGE INTO <target_table> d USING (
          SELECT DISTINCT *
          FROM TABLE(<pipelined_proc>(acct))
        ) s
        ON (<condition>   
        WHEN NOT MATCHED THEN INSERT (
          <cols>
          ) VALUES (
    <cols>      );
        COMMIT;
      END;
    Thanks,
    Vikram

    The thread title's ORA-01002: fetch out of sequence error is potentially from the merge statement restarting to get a consistent view of the data.
    It looks like "acct" is a REF CURSOR. If the merge decides to restart, the cursor cannot be restarted, so you will get a ORA-01002: fetch out of sequence error. That's a problem with using a ref cursor inside a SQL statement that modifies data - the statement can restart.
    E.g. see AskTom: Ask Tom &amp;quot;BEFORE Triggers Fired Multiple Times &amp;quot;
    The current URL for the statement
    If the triggering statement of a BEFORE statement trigger is an UPDATE or DELETE statement that conflicts with an UPDATE statement that is running, then the database does a transparent ROLLBACK to SAVEPOINT and restarts the triggering statement. The database can do this many times before the triggering statement completes successfully. Each time the database restarts the triggering statement, the trigger fires. The ROLLBACK to SAVEPOINTdoes not undo changes to package variables that the trigger references. To detect this situation, include a counter variable in the package.
    is PL/SQL Triggers

  • Fetch out of sequence error

    Hi,
    I've a pro C code which is currently connecting to Oracle 9i DB through 8.0.6 client. Now I've recompiled the same code with 9.2.0.6 client. Whenever it comes to a code involving cursors, I'm getting a fetch out of sequence error. I use ref cursors with no FOR UPDATE clause. What else could be issue? PLease help
    Regards,
    David

    I'm pasting the relavant part.
    #include <stdio.h>
    #include <stdlib.h>
    #include <string.h>
    #include <ctype.h>
    #include <windows.h>
    #define CREW_FETCH_STARTUP          1000
    EXEC SQL BEGIN DECLARE SECTION;
    VARCHAR          la_s_dbcr_crew_id_startup          [1000][11];
    VARCHAR          la_s_dbcr_crew_name_startup          [1000] [8];
    short     int     li_cr_tmp_ind1_startup,
                   li_cr_tmp_ind2_startup;
    SQL_CURSOR CREW_ACTIVE_CUR;
    int vb_cr_sent_count = 0;
    EXEC SQL END DECLARE SECTION;
    EXEC SQL INCLUDE SQLCA;
    EXEC SQL INCLUDE GP_SQL_Def;
    EXEC ORACLE OPTION (MAXOPENCURSORS=20);
    EXEC SQL ALLOCATE :CREW_ACTIVE_CUR;
         EXEC SQL EXECUTE
         BEGIN
              PKG.PROCESS_CREW_STARTUP(:ls_cr_param_market_area, 2, :CREW_ACTIVE_CUR,
                                            :dummy1, :dummy2,                                                             :return_code, :return_msg);
    END;
    END-EXEC;
              for(ln_ctr1=0;ln_ctr1 < CREW_FETCH_STARTUP;ln_ctr1++) {
                   VAR_INIT(la_s_dbcr_crew_id_startup[ln_ctr1]);
                   VAR_INIT(la_s_dbcr_crew_name_startup[ln_ctr1]);
                   la_i_cr_tmp_ind1_startup[ln_ctr1] = 0;
                   la_i_cr_tmp_ind2_startup[ln_ctr1] = 0;
              EXEC SQL
              FETCH :CREW_ACTIVE_CUR
              INTO     :la_s_dbcr_crew_id_startup :la_i_cr_tmp_ind1_startup,
                   :la_s_dbcr_crew_name_startup :la_i_cr_tmp_ind2_startup;
              MessageBox(NULL,lc_s_crew_tmp_msg_str,lc_s_crew_tmp_msg_str,MB_OK);
              if (sqlca.sqlcode < 0)      {
                   if (DEBUG_CE)           {
                        sprintf(lc_s_crew_tmp_msg_str,"Error in Fetch Cursor(CREW_ACTIVE_CUR) (%s)",
                                                                                         sqlca.sqlerrm.sqlerrmc);
                        MessageBox(NULL,lc_s_crew_tmp_msg_str,lc_s_crew_tmp_msg_str,MB_OK);
                   return -1;
              }

  • ProC code- error ORA-1002 fetch out of sequence

    Hi,
    we have an application currntly running on an HP UX system that uses Oracle 9i database.
    the pro*C codes work fine with Oracle 9i, on the older system. however now we are migrating it to LINUX system (ORACLE 10g). in the new system we are facing issues with fetch statement
    here is how we have the code:
    the cursor statement:
    EXEC SQL DECLARE diff_cns_list CURSOR FOR
    select PREV.CNS_CODE,
    PREV.CNS_DESCRIPTION,
    PREV.CGP_CODE,
    CURR.CNS_DESCRIPTION,
    CURR.CGP_CODE
    from NCIP_CNS_LIST PREV, NCIP_CNS_LIST CURR
    where CURR.SAMPLE_DATE =
    to_date('01' || :currdate || ' 00:00','ddyymm hh24:mi')
    and PREV.SAMPLE_DATE =
    to_date('01' || :prevdate || ' 00:00','ddyymm hh24:mi')
    and PREV.CNS_CODE = CURR.CNS_CODE
    and (PREV.CGP_CODE != CURR.CGP_CODE or
    PREV.CNS_DESCRIPTION != CURR.CNS_DESCRIPTION);
    ======================
    currdate=1106 (i.e. june 2011)
    prevdate=1105 (i.e. may 2011)
    ======================
    cursor is opened and then following fetch statement is run:
    while( 1 )
    exec sql FETCH diff_cns_list INTO :prev_vcns,
    :prev_vdesc,
    :prev_vcgp,
    :curr_vdesc,
    :curr_vcgp;
    /* If no data found then exit from loop */
    if( sqlca.sqlcode == 1403 )
    break;
    else if( sqlca.sqlcode != 0 )
    vLOG_Msg(LOG_MSG_ERROR,"fniCmpNcipCnsList",
    "ORACLE error on fetching diff_cns_list %s", sqlca.sqlerrm.sqlerrmc);
    return( ERROR );
    oravarterm( prev_vcns );
    oravarterm( prev_vdesc );
    oravarterm( prev_vcgp );
    oravarterm( curr_vdesc );
    oravarterm( curr_vcgp );
    fprintf( output_fp,"'%s','%s','%s','%s','%s'\r\n",prev_vcns.arr,
    prev_vdesc.arr,
    prev_vcgp.arr,
    curr_vdesc.arr,
    curr_vcgp.arr);
    the code runs fine in the old operating system (HP UX) where oracle 9i was used.
    but fails in Oracle 10g(OS-LINUX).
    the probable reason that we found out is that:
    the fetch statement returns zero rows, that is the reason why this error is being displayed.
    but Oracle 9i seemed to work out well with this.
    we tried reducing the cursor conditions, where it fetches 3 rows. this is when is the fetch statement works fine.
    the functionality of the code is that it should work fine even with no rows selected. Is there a way we can modfy the code to work with zero rows as well.
    the error we are getting is : ORA-01002: fetch out of sequence
    ==========================
    as per what is given in Oracle sites:
    1) Fetching from a cursor after the last row has been retrieved and the ORA-1403 error returned. 2) If the cursor has been opened with the FOR UPDATE clause, fetching after a COMMIT has been issued will return the error. 3) Rebinding any placeholders in the SQL statement, then issuing a fetch before reexecuting the statement.
    ========================
    we have checked:
    1>this is not the case and ORA-1403 not returned
    2>No update statements involved , there is a insert statement which inserts data in this table
    3>i am not clear with this one.
    Could anyone please guide us through this, please?

    Note the name of this forum is SQL Developer (Not for general SQL/PLSQL questions) - so for issues with the SQL Developer tool. Please post these questions under the dedicated OCCI forum (you've posted there before).
    Regards,
    K.

Maybe you are looking for