Oracle.ManagedDataAccess.4.121.1.0 System.IndexOutOfRangeException — oracle-tech

    Forum Stats

  • 3,715,916 Users
  • 2,242,905 Discussions
  • 7,845,681 Comments

Discussions

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Oracle.ManagedDataAccess.4.121.1.0 System.IndexOutOfRangeException

4296641
4296641 Member Posts: 1
edited July 2020 in ODP.NET

I create a table,then get some data by a query. then I added   a column into this table and try again. an exception will be throwed:

System.IndexOutOfRangeException:

   在 Oracle.ManagedDataAccess.Client.OracleDataReader.RetrieveSchemaTable(DataTable& dataTable, Boolean isFromEx)

   在 Oracle.ManagedDataAccess.Client.OracleDataReader.GetSchemaTableCopy(DataTable& dataTable, Boolean isFromEx)

   在 Oracle.ManagedDataAccess.Client.OracleDataReader.GetSchemaTable()

   在 IBatisNet.DataMapper.Commands.DataReaderDecorator.System.Data.IDataReader.GetSchemaTable()

   在 System.Data.ProviderBase.SchemaMapping..ctor(DataAdapter adapter, DataSet dataset, DataTable datatable, DataReaderContainer dataReader, Boolean keyInfo, SchemaType schemaType, String sourceTableName, Boolean gettingData, DataColumn parentChapterColumn, Object parentChapterValue)

   在 System.Data.Common.DataAdapter.FillMappingInternal(DataSet dataset, DataTable datatable, String srcTable, DataReaderContainer dataReader, Int32 schemaCount, DataColumn parentChapterColumn, Object parentChapterValue)

   在 System.Data.Common.DataAdapter.FillMapping(DataSet dataset, DataTable datatable, String srcTable, DataReaderContainer dataReader, Int32 schemaCount, DataColumn parentChapterColumn, Object parentChapterValue)

   在 System.Data.Common.DataAdapter.FillFromReader(DataSet dataset, DataTable datatable, String srcTable, DataReaderContainer dataReader, Int32 startRecord, Int32 maxRecords, DataColumn parentChapterColumn, Object parentChapterValue)

   在 System.Data.Common.DataAdapter.Fill(DataTable[] dataTables, IDataReader dataReader, Int32 startRecord, Int32 maxRecords)

   在 System.Data.DataTable.Load(IDataReader reader, LoadOption loadOption, FillErrorEventHandler errorHandler)

   在 IBatisNet.DataMapper.SqlMapper.QueryForDataTable(String statementName, Object parameterObject)

Best Answer

  • Alex Keh-Oracle
    Alex Keh-Oracle Posts: 2,752 Employee
    edited July 2020 Accepted Answer

    The problem is usually the statement cache. Typically, a connection does not retrieve results, alter a schema, and execute the same statement again. As such, ODP.NET turns Self Tuning on by default, which auto sizes the statement cache for the app. The statement cache retains the parsed statement and metadata for later reuse. If the table has changed, the cache statement is no longer valid, which is likely why you see this error.

    You can disable statement caching for individual statements by setting OracleCommand.AddToStatementCache to false. Alternatively, you can set Self Tuning to false in the connection string if these schema changes constantly occur and multiple statements will be the changes. Another alternative is to set Statement Cache Purge to true in the connection string. This setting will purge the statement cache when the connection goes back to the pool.

Answers

  • Alex Keh-Oracle
    Alex Keh-Oracle Posts: 2,752 Employee
    edited July 2020 Accepted Answer

    The problem is usually the statement cache. Typically, a connection does not retrieve results, alter a schema, and execute the same statement again. As such, ODP.NET turns Self Tuning on by default, which auto sizes the statement cache for the app. The statement cache retains the parsed statement and metadata for later reuse. If the table has changed, the cache statement is no longer valid, which is likely why you see this error.

    You can disable statement caching for individual statements by setting OracleCommand.AddToStatementCache to false. Alternatively, you can set Self Tuning to false in the connection string if these schema changes constantly occur and multiple statements will be the changes. Another alternative is to set Statement Cache Purge to true in the connection string. This setting will purge the statement cache when the connection goes back to the pool.

Sign In or Register to comment.