I am using it to connect from an asp.net 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
database.
The error I am getting is:
Unable to load DLL 'db2app.dll'.
The details of the error are below. Also below is my asp.net web page
code.
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=8.1.2.1, PublicKeyToken=7c307b91aa13d208" %>
Any idea why the db2app.dll is not found? It is on my system, in the
sqllib/bin directory.
thanks,
-Steve
Here is my asp.net web page code:
<%@ Page Language="C#" Trace=true %>
<%@ Assembly Name="IBM.Data.DB2, Culture=neutral,
Version=8.1.2.1, PublicKeyToken=7c307b91aa13d208" %>
<%@ Import Namespace="IBM.Data.DB2" %>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.SqlClient" %>
<%@ Import Namespace="System.IO" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<script runat="server">
void linkConnect_Click(object sender, EventArgs e)
{
String cs = "Server=192.168.1.160:446; " +
"Database=S104VDNM; " +
"UID=QSECOFR; PWD=xyz;";
DB2Connection conn = new DB2Connection(cs);
conn.Open();
conn.Close();
}
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
'db2app.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
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=8.1.2.1, 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.
thanks,
-Steve
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
-Steve