Home All Groups Group Topic Archive Search About
Author
2 Mar 2006 6:50 PM
HARI PRASD BARU
Hello

      I am facing a very different issue with db2 connect.
DBconnection string is
Database=mydatabase;UID=userid;PWD=password;pooling = false

mydatabase is a system DSN created while configuring db2 node.

      Sometimes all of sudden i am getting this issue error
      "The type initializer for "IBM.Data.DB2.DB2Connection" threw an
exception."

at IBM.Data.DB2.DB2Connection..ctor(String connectionString)    
at
Microsoft.Practices.EnterpriseLibrary.Data.DB2.DB2Database.GetConnection()   

at Microsoft.Practices.EnterpriseLibrary.Data.Database.LoadDataSet(DBCommandWrapper command, DataSet dataSet

       But  after restarting the IIS everything works fine for 1/2 days and
again starts same issue.
      In some developer machines i am not at all getting this issue.

     #1) asp.net and given permission to IWAM_USR under which worker process
is running.
    #2) given permission to SQLLIB folder to IWAM_USR.
    #3)Added IWAM_USR to the db2users group.
    #4) Reregistered DB2client 8.1.7

plz help me out if u have any solutions..
Thanks in advance

Author
3 Mar 2006 9:01 AM
Frans Bouma [C# MVP]
HARI PRASD BARU wrote:

Show quote
> Hello
>    
>       I am facing a very different issue with db2 connect.
> DBconnection string is
> Database=mydatabase;UID=userid;PWD=password;pooling = false
>
> mydatabase is a system DSN created while configuring db2 node.
>      
>       Sometimes all of sudden i am getting this issue error
>       "The type initializer for "IBM.Data.DB2.DB2Connection" threw an
> exception."
>
> at IBM.Data.DB2.DB2Connection..ctor(String connectionString)    
> at
> Microsoft.Practices.EnterpriseLibrary.Data.DB2.DB2Database.GetConnecti
> on() 
> at
> Microsoft.Practices.EnterpriseLibrary.Data.Database.LoadDataSet(DBComm
> andWrapper command, DataSet dataSet
>
>        But  after restarting the IIS everything works fine for 1/2
> days and again starts same issue.
>       In some developer machines i am not at all getting this issue.
>
>      #1) asp.net and given permission to IWAM_USR under which worker
> process is running.
>     #2) given permission to SQLLIB folder to IWAM_USR.
>     #3)Added IWAM_USR to the db2users group.
>     #4) Reregistered DB2client 8.1.7
>
> plz help me out if u have any solutions..
> Thanks in advance

    Your connection string is wrong. You don't need a DSN, that's for
ODBC. Your connection string has to have the format:
"Database=SAMPLE;Server=MyServer;UID=Foo;PWD=Bar;"

        FB


--
------------------------------------------------------------------------
Get LLBLGen Pro, productive O/R mapping for .NET: http://www.llblgen.com
My .NET blog: http://weblogs.asp.net/fbouma
Microsoft MVP (C#)
------------------------------------------------------------------------
Author
3 Mar 2006 5:39 PM
HARI PRASD BARU
Hey Frans

     I am not mentioning DSN name in my connectionstring.
   Database=SAMPLE;UID=Foo;PWD=Bar;pooling=false;

You mean it will look for DSN first and then look for DB2alias which is
configured from DB2client.

Show quote
"Frans Bouma [C# MVP]" wrote:

> HARI PRASD BARU wrote:
>
> > Hello
> >    
> >       I am facing a very different issue with db2 connect.
> > DBconnection string is
> > Database=mydatabase;UID=userid;PWD=password;pooling = false
> >
> > mydatabase is a system DSN created while configuring db2 node.
> >      
> >       Sometimes all of sudden i am getting this issue error
> >       "The type initializer for "IBM.Data.DB2.DB2Connection" threw an
> > exception."
> >
> > at IBM.Data.DB2.DB2Connection..ctor(String connectionString)    
> > at
> > Microsoft.Practices.EnterpriseLibrary.Data.DB2.DB2Database.GetConnecti
> > on() 
> > at
> > Microsoft.Practices.EnterpriseLibrary.Data.Database.LoadDataSet(DBComm
> > andWrapper command, DataSet dataSet
> >
> >        But  after restarting the IIS everything works fine for 1/2
> > days and again starts same issue.
> >       In some developer machines i am not at all getting this issue.
> >
> >      #1) asp.net and given permission to IWAM_USR under which worker
> > process is running.
> >     #2) given permission to SQLLIB folder to IWAM_USR.
> >     #3)Added IWAM_USR to the db2users group.
> >     #4) Reregistered DB2client 8.1.7
> >
> > plz help me out if u have any solutions..
> > Thanks in advance
>
>     Your connection string is wrong. You don't need a DSN, that's for
> ODBC. Your connection string has to have the format:
> "Database=SAMPLE;Server=MyServer;UID=Foo;PWD=Bar;"
>
>         FB
>
>
> --
> ------------------------------------------------------------------------
> Get LLBLGen Pro, productive O/R mapping for .NET: http://www.llblgen.com
> My .NET blog: http://weblogs.asp.net/fbouma
> Microsoft MVP (C#)
> ------------------------------------------------------------------------
>

AddThis Social Bookmark Button