Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>We - and others - have also had this problem recently and in the past. It seems to be related to multi-threaded access to the non-thread-safe <code>SqlConnection</code>. The following <strong>really long (!)</strong> post contains more examples and some more detail on the issue: <a href="http://social.msdn.microsoft.com/forums/en-US/adodotnetdataproviders/thread/74a5db87-c63f-4386-b317-e848dedb2cd9/" rel="nofollow noreferrer" title="SQLDataReader.GetOrdinal() fails rarely with IndexOutOfRange">SQLDataReader.GetOrdinal() fails rarely with IndexOutOfRange</a>. There bbzippo states: </p> <blockquote> <p>"It's evident that SqlDataReader reads a result set left over from the previous query executed on the same connection a couple of seconds ago."</p> </blockquote> <p>Unfortunately, I haven't found any real explanation of why this exception occurs suddenly in code that has been working without a problem for some time.</p> <p>Some of the suggestions made in the given thread are:</p> <ol> <li>Turn connection pooling off, so your connection string would look like e.g. <code>"Data Source=Sql2005;Initial Catalog=MyDbName;User Id=MyLogin;Password=MyPass;Pooling=false"</code> (this most likely will mean a performance hit for your application but is sure to work)</li> <li>Refactor all <code>static</code> code referencing your <code>SqlConnection</code> instance(s) to <code>non-static</code></li> <li>Fix possible multi-threaded access to your <code>SqlConnection</code>s (this might not be that easy...)</li> </ol> <p>I'm still trying to find the source of the error in our application but it's not that easy because I haven't been able to reproduce it outside our live environment. <a href="http://social.msdn.microsoft.com/forums/en-US/adodotnetdataproviders/thread/74a5db87-c63f-4386-b317-e848dedb2cd9/#8097bc33-ab26-49d2-b933-620adee94dae" rel="nofollow noreferrer">Matt Neerincx [MSFT] suggests in one of his answers</a> in the above mentioned post to use different connection strings and thus different connection pools for different parts of your application to help narrow down the source of the problem.</p> <p>Another read I found regarding this problem was on the hibernate forums: <a href="https://forum.hibernate.org/viewtopic.php?p=2386963" rel="nofollow noreferrer">https://forum.hibernate.org/viewtopic.php?p=2386963</a>, where one poster also had problems with lazy-loading in a multi-threaded scenario.</p> <p>Hope this will guide anyone in the right direction for a fix.</p> <p>Oliver</p> <p>P.S. This is a copy of my answer to <a href="https://stackoverflow.com/questions/2590893/nhibernate-fieldnamelookup-throws-indexoutofrangeexception">Nhibernate FieldNameLookup throws IndexOutOfRangeException</a></p>
    singulars
    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.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      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