By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,285 Members | 2,124 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,285 IT Pros & Developers. It's quick & easy.

unable to load dll db2app.dll . Error using DB2 in ASP.NET application.

P: n/a
I have installed the trial of db2 enterprise server on my w2k PC. Have
also installed fix pack 8 of that product.

I am using it to connect from an web page to an IBM as400. the
400 is at v5r1.
From the db2 command line shell I am able to connect to the as400


The error I am getting is:
Unable to load DLL 'db2app.dll'.

The details of the error are below. Also below is my web page

I am not using Visual Studio to code my page, so I did not add a
reference to the DB2 .NET namespace in the normal way. I am using the
assembly directive:
<%@ Assembly Name="IBM.Data.DB2, Culture=neutral,
Version=, PublicKeyToken=7c307b91aa13d208" %>

Any idea why the db2app.dll is not found? It is on my system, in the
sqllib/bin directory.

Here is my web page code:

<%@ Page Language="C#" Trace=true %>
<%@ Assembly Name="IBM.Data.DB2, Culture=neutral,
Version=, PublicKeyToken=7c307b91aa13d208" %>
<%@ Import Namespace="IBM.Data.DB2" %>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.SqlClient" %>
<%@ Import Namespace="System.IO" %>


<script runat="server">

void linkConnect_Click(object sender, EventArgs e)
String cs = "Server=; " +
"Database=S104VDNM; " +
DB2Connection conn = new DB2Connection(cs);

Here is the error message:

Unable to load DLL 'db2app.dll'.
Description: An unhandled exception occurred during the execution of
the current web request. Please review the stack trace for more
information about the error and where it originated in the code.

Exception Details: System.DllNotFoundException: Unable to load DLL

Stack Trace:

[DllNotFoundException: Unable to load DLL 'db2app.dll'.]
IBM.Data.DB2.v.nmpTraceOn() +0
IBM.Data.DB2.v.e() +97
IBM.Data.DB2.DB2ConnPool.d() +324
IBM.Data.DB2.DB2ConnPool..ctor() +21
IBM.Data.DB2.DB2Connection..cctor() +67

Nov 12 '05 #1
Share this Question
Share on Google+
3 Replies

P: n/a
did you initalize command line enviroment for both visual stuido and

Nov 12 '05 #2

P: n/a

shiggy wrote:
did you initalize command line enviroment for both visual stuido and

just did that and I got the same results ( sad face )
Unable to load DLL 'db2app.dll'.

I am not going the standard Visual Studio, add a reference route. I am
using the freebie Visual Studio Developer Express from Microsoft. And I
cant figure out how to add references, so I was told to look in the GAC
( the /WINNT/Assembly directory ) and retrieve the PublicKeyToken and
Version of the DB2 assembly. I then specify those values in an
"@Assembly" directive at the top of the .aspx file.

<%@ Assembly Name="IBM.Data.DB2, Culture=neutral,
Version=, PublicKeyToken=7c307b91aa13d208" %>

I dont think there is anything wrong with this approach. I actually
prefer the manual step instead of relying on GUI magic. But there is a
lot I dont know, so I dont know if refering to an assembly this way is
ok or not.



Nov 12 '05 #3

P: n/a
This issue ended up being caused by two problems. The first was that
DB2Connection was not part of the db2 trial that I had downloaded. I
told to use the Enterprise Server for Windows. The 2nd problem was due
the user ( ASPNET ) that the IIS server on my PC runs as not having
authority to files in the DB2 directory.

This was the trace that the IBM support tech had me run that identified
the authority problem:
db2trc on -f trace.dmp
<reproduce the problem-try to connect from ASP .NET>
db2trc off


Nov 12 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.