|
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 was told to use the Enterprise Server for Windows. The 2nd problem was due to the user ( ASPNET ) that the IIS server on my PC runs as not having authority to executable 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 For those interested, here is the code of a simple .aspx file which displays the contents of an as400 database file in a grid in the browser: -Steve <%@ Page Language="C#" Trace=false %> <%@ Assembly Name="IBM.Data.DB2, Culture=neutral, Version=8.1.2.1 <http://8.1.2.1>, PublicKeyToken=7c307b91aa13d208" %> <%@ Import Namespace="IBM.Data.DB2" %> <%@ 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) { DB2Connection conn = null; DB2Command cmd = null; try { String cs = "Server=192.168.1.160:446 <http://192.168.1.160:446>; " + "Database=S104abcd; " + "UID=xyx; PWD=abc;"; grid1.Visible = false; conn = new DB2Connection(cs); cmd = new DB2Command("select ns, class, module from FAXMAIL.ACACATA", conn); conn.Open(); grid1.DataSource = cmd.ExecuteReader(); grid1.DataBind(); } finally { if ( conn != null ) conn.Close(); grid1.Visible = true; } } </script> <html xmlns="http://www.w3.org/1999/xhtml" > <head runat="server"> <title>Display an AS400 file in a grid</title> </head> <body> <form id="form1" runat="server"> <div> <asp:LinkButton ID="linkConnect" Runat="server" OnClick="linkConnect_Click"> Connect to as400 </asp:LinkButton> <br /> <br /> <asp:DataGrid ID="grid1" Runat="server" Visible=false> </asp:DataGrid> </div> </form> </body> </html>
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.