If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > accessing db2 database in C#

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 04-01-08, 07:30
selvakumar_rama selvakumar_rama is offline
Registered User
 
Join Date: Apr 2008
Posts: 1
Red face accessing db2 database in C#

Hi,
I am developing windows application using c# 2.0 and DB2. I need to fetch data from DB2, I used to IBM.Data.DB2.dll in my application. DB2 is installed in server machine. My machine doesn't have client DB2. I refer IBM.Data.DB2.dll into my application via <add reference>, I got this dll from server.
********************************
Code snippet:
DB2Connection Con = new DB2Connection("Server=servermachinename; Database=databasename; userid=Db2admin; password=password;"); (*)
DB2Command cmd = new DB2Command();
cmd.CommandText = "Select * from Reports";
cmd.Connection = Con;
cmd.CommandTimeout = 60;
Con.Open();
DB2DataReader dr = cmd.ExecuteReader(CommandBehavior.CloseConnection) ;
********************************
But when I am executing application, exception is raising, , Exception is rasing in "Con" declaration area(*).
following are the exception...
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 397

please help me, it is very urgent requirment...

Selvakumar
Reply With Quote
  #2 (permalink)  
Old 04-01-08, 09:16
guyprzytula guyprzytula is offline
Registered User
 
Join Date: Jun 2006
Posts: 471
is this possible without db2 installed ? java type 4 connection is possible, but c# I think needs db2
__________________
Best Regards, Guy Przytula
DB2 UDB LUW certified V6/7/8
Reply With Quote
Reply

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 On
Pingbacks are On
Refbacks are On