p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   ADO.NET (http://p2p.wrox.com/forumdisplay.php?f=109)
-   -   fetch data from IBM DB2 using C# (http://p2p.wrox.com/showthread.php?t=67088)

selvakumar_rama April 2nd, 2008 05:17 AM

fetch data from IBM DB2 using C#
Hi all,
We have a requirment to develop windows based application using C# 2.0 and IBM DB2.
For connecting to DB2, I am refering IBM.Data.DB2.dll in my application. During run time it raise exception in connection declaration.
I have DB2 Client in my local machine, and it is connecting to server also. But through appliaction it raise exception.
I got IBM.Data.DB2.dll from server machine. I refered this dll into my application. I am attaching my code snippet here.

DB2Connection Con = new DB2Connection("Server=myserver; Database=dbname; UID=Db2admin; PWD=password;");
DB2Command cmd = new DB2Command();
cmd.CommandText = "Select * from Reports";
cmd.Connection = Con;
cmd.CommandTimeout = 60;
DB2DataReader dr = cmd.ExecuteReader(CommandBehavior.CloseConnection) ;

Exception is raising in connection string line itself. Please tell me why this exception is raising.
Followig are the Exception message.

************************************************** *******************
System.TypeInitializationException: The type initializer for 'IBM.Data.DB2.DB2Connection' threw an exception. ---> System.DllNotFoundException: Unable to load DLL 'db2app.dll': The specified module could not be found. (Exception from HRESULT: 0x8007007E)

   at IBM.Data.DB2.v.nmpTraceOn()
   at IBM.Data.DB2.v.e()
   at IBM.Data.DB2.DB2ConnPool.d()
   at IBM.Data.DB2.DB2ConnPool..ctor()
   at IBM.Data.DB2.DB2Connection..cctor()
   --- End of inner exception stack trace ---
   at IBM.Data.DB2.DB2Connection..ctor(String connectionString)
   at TestWebServiceConnection.Form1.ApplicationFormInde xReport() in D:\Selvakumar\VS Application\TestWebServiceConnection\TestWebServic eConnection\Form1.cs:line 396

************************************************** *******************

Selvakumar R

All times are GMT -4. The time now is 12:58 PM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.