title: problem with NHibernate and iSeries DB2
body: <p>Ok So I have an AS400/iSeries running v5r4. I have an application that was using classic NHibernate to connect and do some basic crud. Now I have pulled that app (which sat for 2 years) off the shelf of TFS and onto a new PC and cannot seem to get it running. </p>
  
  <p>Here is my Hibernate Config:</p>
  
  <pre><code>&lt;hibernate-configuration xmlns="urn:nhibernate-configuration-2.2"&gt;
      &lt;session-factory&gt;
        &lt;property name="connection.provider"&gt;
          NHibernate.Connection.DriverConnectionProvider
        &lt;/property&gt;
        &lt;property name="dialect"&gt;
          NHibernate.Dialect.DB2400Dialect
        &lt;/property&gt;
        &lt;property name="proxyfactory.factory_class"&gt;NHibernate.ByteCode.LinFu.ProxyFactoryFactory, NHibernate.ByteCode.LinFu&lt;/property&gt;
        &lt;property name="connection.connection_string"&gt;
          DataSource=207.206.106.19;
          Database=AS400;
          userID=XXXXXX;
          Password=XXXXXXX;
          LibraryList=FMSFILTST,BEFFILT,HRDBFT,HRCSTFT,J20##X2DEV,GLCUSTDEV,OSL@@F3DEV;
          Naming=System;
          Initial Catalog=*SYSBAS;
        &lt;/property&gt;
        &lt;property name="use_outer_join"&gt;true&lt;/property&gt;
        &lt;property name="query.substitutions"&gt;
          true 1, false 0, yes 'Y', no 'N'
        &lt;/property&gt;
        &lt;property name="show_sql"&gt;false&lt;/property&gt;
        &lt;mapping assembly="BusinessLogic" /&gt;
      &lt;/session-factory&gt;
    &lt;/hibernate-configuration&gt;
  </code></pre>
  
  <p>I have all the proper DLL's included (NHibernate, castle, iesi, antlr3 , log4 etc). Also have this line in my web.config</p>
  
  <pre><code>&lt;runtime&gt;
      &lt;assemblyBinding&gt;
        &lt;qualifyAssembly partialName="IBM.Data.DB2.iSeries" fullName="IBM.Data.DB2.iSeries,Version=10.0.0.0,PublicKeyToken=9CDB2EBFB1F93A26,Culture=neutral"/&gt;
      &lt;/assemblyBinding&gt;
    &lt;/runtime&gt;
  </code></pre>
  
  <p>Yet I am still getting the following error as soon as I call  </p>
  
  <pre><code>NHibernate.Cfg.Configuration().Configure().BuildSessionFactory().OpenSession();
  </code></pre>
  
  <p>The error is as follows </p>
  
  <blockquote>
    <p>Unable to cast object of type
    'IBM.Data.DB2.iSeries.iDB2Connection'
    to type 'System.Data.Common.DbCommand'</p>
  </blockquote>
  
  <p>I am dying to get some help with this. Any assistance is appreciated. Thanks!</p>