I'm getting the following oracle error when my app is deployed on the server only, and not when running the exact same executable on my local machine:
The stack trace points to a simple select statement with a join, that I can successfully execute via TOAD locally and via SQL Plus on the problem server.
The top half of the stacktrace is:
Oracle.DataAccess.Client.OracleException ORA-01002: fetch out of sequence
at Oracle.DataAccess.Client.OracleException.HandleErrorHelper(Int32 errCode, OracleConnection conn, IntPtr opsErrCtx, OpoSqlValCtx* pOpoSqlValCtx, Object src, String procedure, Boolean bCheck)
at Oracle.DataAccess.Client.OracleException.HandleError(Int32 errCode, OracleConnection conn, IntPtr opsErrCtx, Object src, Boolean bCheck)
at Oracle.DataAccess.Client.OracleDataReader.Read()
at System.Data.Common.DataAdapter.FillLoadDataRow(SchemaMapping mapping)
at System.Data.Common.DataAdapter.FillFromReader(DataSet dataset, DataTable datatable, String srcTable, DataReaderContainer dataReader, Int32 startRecord, Int32 maxRecords, DataColumn parentChapterColumn, Object parentChapterValue)
at System.Data.Common.DataAdapter.Fill(DataTable[] dataTables, IDataReader dataReader, Int32 startRecord, Int32 maxRecords)
at System.Data.Common.LoadAdapter.FillFromReader(DataTable[] dataTables, IDataReader dataReader, Int32 startRecord, Int32 maxRecords)
at System.Data.DataTable.Load(IDataReader reader, LoadOption loadOption, FillErrorEventHandler errorHandler)
at Reconciliation.Models.Legacy.EntityDbEnvironment.OpenEntity(String sql)
at Reconciliation.Models.Legacy.EntityDbEnvironment.Open(String& sql, DataTable& datatable)
**at myProject.Checks.ExecuteSql()**
I can only imagine this is an oracle client problem, but where should I look to resolve this?
I had that issue too. My application was working fine on a machine, and the exact same executable on another machine was getting that fetch out of sequence exception.
My query is a big one which takes a few minutes to run. It is ran by a COM+. I realised that my two environments had a slightly different Component Services configuration. The failing environment had a transaction timeout set to 60s, the other one was set to much more.
To solve this I simply had to go to Component Services, right click on My Computer, Properties, Options, and increase the Transaction timeout.
It makes sense now as the fetch out of sequence exception is happening when you try to access a closed cursor. I understand that the COM+ timeout closed the transaction, therefore the cursor, and thrown that Oracle exception.