2010-11-18 2 views
-2

funniest problems while deploying my softwareに入る運があるようです。ODBCDataReaderのGetValues中に空の例外があります

セットアップ:私は展開された

  • は、Windows 2000の教授
  • .NET 2.0アプリケーション
  • 3.51.26

MySQLのODBC-Connectorを使用してOdbcConnection経由のMySQL 5.0への接続この例外が発生している間の私のアプリケーション:

at System.Data.Odbc.OdbcConnection.HandleError(OdbcHandle hrHandle, RetCode retcode) 
at System.Data.Odbc.OdbcDataReader.GetData(Int32 i, SQL_C sqlctype, Int32 cb, Int32& cbActualOut) 
at System.Data.Odbc.OdbcDataReader.internalGetString(Int32 i) 
at System.Data.Odbc.OdbcDataReader.GetValue(Int32 i, TypeMap typemap) 
at System.Data.Odbc.OdbcDataReader.GetValue(Int32 i) 
at System.Data.Odbc.OdbcDataReader.GetValues(Object[] values) 
at MyAppl.UninterestingStackTace.StartsHere() 

はい、これはスタックトレースだけです。例外メッセージがないため、InnerExceptionもありません(最後の出会い以降もログに記録します)。

コードは次のようになります。

// DtRdr is a passed in ODBCDataReader 
if (DtRdr != null && !DtRdr.IsClosed) 
{ 
    Object[] buffer = new Object[DtRdr.FieldCount]; 

    while (DtRdr.Read()) 
    { 
     DtRdr.GetValues(buffer); // Here happens the exception 

     // Modify buffer and use it 
    } 
} 

それだけで、そのマシン上で起こって、フェッチされたデータ/データベースは、同じネットワーク上の別のマシンを経由して、それを検証し、私も私のdevの上でローカルにそれをテストした(良いです - マシン)、もちろん他のマシンでは再現できません。

Reflectorで見ると、接続からデータを読み取るときに問題があるようです。他のすべての操作は正常に動作している、私は直接データにアクセスすることができます、GetValuesが失敗します。

私は同じエラーを生成し、高速かつ簡単なテストアプリケーションを書きましたが、また、終了後に次の文を出力します

Error in my_thread_global_end(): 1 threads didn't exit 

私は、のためにとても残念これが関連しているかどうかわかりません混乱。

私はもう一度迷子になりました。

編集:はここに私のテストアプリケーションです:

using System; 
using System.Data; 
using System.Data.Odbc; 

namespace ODBCTest 
{ 
    class MainClass 
    { 
     public static void Main (string[] args) 
     { 
      try { 
       Console.WriteLine ("Creating connection..."); 
       using (OdbcConnection conn = new OdbcConnection ("ConnStringHere")) { 
        conn.Open(); 
        Console.WriteLine ("Creating command..."); 
        using (OdbcCommand cmd = conn.CreateCommand()) { 
         cmd.CommandText = "SimpleSelectHere;"; 

         Console.WriteLine ("Creating reader..."); 
         using (OdbcDataReader rdr = cmd.ExecuteReader()) { 
          if (rdr != null && !rdr.IsClosed) { 
           while (rdr.Read()) { 
            object[] temp = new object[rdr.FieldCount]; 
            rdr.GetValues (temp); 
           } 

           Console.WriteLine ("Seems to work fine."); 
          } else { 
           Console.WriteLine ("Could not create reader!"); 
          } 
         } 
        } 
       } 
      } catch (Exception ex) { 
       Console.WriteLine (ex.Message); 
       Console.WriteLine (ex.StackTrace); 
       Console.WriteLine(); 
       if (ex.InnerException != null) 
       { 
        Console.WriteLine (ex.InnerException.Message); 
        Console.WriteLine (ex.InnerException.StackTrace); 
       } else { 
        Console.WriteLine("No InnerException."); 
       } 
      } 

      Console.ReadKey(); 
     } 
    } 
} 

そして、それは出力です:私はのろわれます

Creating connection... 
Creating command... 
Creating reader... 

    at System.Data.Odbc.OdbcConnection.HandleError(OdbcHandle hrHandle, RetCode retcode) 
    at System.Data.Odbc.OdbcDataReader.GetData(Int32 i, SQL_C sqlctype, Int32 cb, Int32& cbActualOut) 
    at System.Data.Odbc.OdbcDataReader.internalGetString(Int32 i) 
    at System.Data.Odbc.OdbcDataReader.GetValue(Int32 i, TypeMap typemap) 
    at System.Data.Odbc.OdbcDataReader.GetValue(Int32 i) 
    at System.Data.Odbc.OdbcDataReader.GetValues(Object[] values) 
    at ODBCTest.MainClass.Main(String[] args) 

No InnerException. 
<At this point I hit a key> 
Error in my_thread_global_end(): 1 threads didn't exit 

答えて

0

また、私のケースでは、Sybaseデータベースを使用している間にMDAC 2.6 SP2でこの問題が確認されました。バージョン2.8 SP1がインストールされました。