Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > .NET > Other .NET > ADO.NET
Password Reminder
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old April 2nd, 2008, 05:17 AM
Registered User
Join Date: Apr 2008
Location: , , India.
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;
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
Reply With Quote

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

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

All times are GMT -4. The time now is 05:51 AM.

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