Wrox Programmer Forums
Go Back   Wrox Programmer Forums > .NET > Other .NET > ADO.NET
|
ADO.NET For discussion about ADO.NET.  Topics such as question regarding the System.Data namespace are appropriate.  Questions specific to a particular application should be posted in a forum specific to the application .
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ADO.NET section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old April 2nd, 2008, 05:17 AM
Registered User
 
Join Date: Apr 2008
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to selvakumar_rama
Default 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;
Con.Open();
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

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

Regards,
Selvakumar R





Similar Threads
Thread Thread Starter Forum Replies Last Post
Fetch Data From server ashvinm JSP Basics 2 March 10th, 2008 07:48 AM
Fetch data from DBF to SQL arty125 VB.NET 1 August 20th, 2007 01:06 PM
Code snippet to fetch data from other site leo_vinay ASP.NET 1.0 and 1.1 Professional 3 April 3rd, 2006 12:31 PM
Data Adaptor - IBM AS400 JesseH ADO.NET 1 February 21st, 2006 01:19 AM
Access DB2 on AS/400 using IBM OLE DB Provider KiwiMark SQL Server 2005 2 February 16th, 2006 07:40 PM





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