DB2 data over web browser

20 pts.
Tags:
AS/400 DB2
DB2
System i
Our solutions resides in System i and its all are internal developed systems. Our applications are Logistics business driven and now we have the need to publish these informations over web for view by customers. HOW do i do that.. and what should i consider..

Software/Hardware used:
System i
ASKED: May 3, 2010  2:55 AM
UPDATED: May 5, 2010  1:02 PM

Answer Wiki

Thanks. We'll let you know when a new response is added.

<a href=”http://blogs.systeminetwork.com/isnblogs/productlines/2008/08/getting_a_grip_on_app_moderniz.html”>http://blogs.systeminetwork.com/isnblogs/productlines/2008/08/getting_a_grip_on_app_moderniz.html</a>

Discuss This Question: 2  Replies

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • TomLiotta
    I'm not sure where even to begin with this question. Can you answer how you would do it on Windows or UNIX? If you have some general basic background, there might be common ground for discussion. What web serving are you currently involved with on any platform? Tom
    125,585 pointsBadges:
    report
  • Craig Hatmaker
    We are doing what you want. We have an iSeries with logisitics information. We have an IIS server granting customers web access. It leverages ASP.Net's security to identify who is logged in. It uses the User ID as a key to retrieve Customer ID's from a SQL Express database on the Webserver. We use ASP.Net VB with ADO/ODBC to pull records from SQL Express and the iSeries - and then display them on the web (only records belonging to Customer ID's for that User ID are displayed). From that list, customers can then view scanned images related to their shipments from a WINTEL based document management system. Our iSeries and the Document Management System is within our Firewall. The web server is in our DMZ. Here is a sample of the ASP.NET VB code that displays Customer BOLs. Get Customer "Bill To" IDs for the "User ID" (sID1) from a SQL Express Database
    Function Get_BillTos(ByVal sID1 As String) As String
    
            Dim sConnect As String = _
                ConfigurationManager.ConnectionStrings("SQLExpress").ConnectionString
    
            Dim sSQL As String = _
               "Select      Bill2s " & _
               "From        User_Bill2s " & _
               "Where       UserID = ('" & Trim(sID1) & "') "
    
            Dim cn As Object
            cn = Server.CreateObject("ADODB.Connection")
            cn.Open(sConnect)
    
            Dim rs As Object
            rs = Server.CreateObject("ADODB.recordset")
            rs.Open(sSQL, cn)
    
            If rs.eof Then
                Get_BillTos = ""
            Else
                Get_BillTos = Build_String_From_Rs(rs)
            End If
    
            rs.close()
            cn.close()
    
        End Function
    
    Get a Customer Order Number matching a Customer's "BOL" from a DB2 Database
        Function Get_BOL_Orders(ByVal sBOL As String, ByVal sBill2s As String) As String
    
            Dim sConnect As String = _
                ConfigurationManager.ConnectionStrings("iSeries").ConnectionString
    
            Dim sSQL As String = _
               "Select      ORODR# " & _
               "From        ORDERL1 " & _
               "Where       ORCSH# = '" & Trim(sBOL) & "' " & _
               "  And       Trim(ORBILL) in (" & Trim(sBill2s) & ") "
    
            Dim cn As Object
            cn = Server.CreateObject("ADODB.Connection")
            cn.Open(sConnect)
    
            Dim rs As Object
            rs = Server.CreateObject("ADODB.recordset")
            rs.Open(sSQL, cn)
    
            If rs.eof Then
                Get_BOL_Orders = ""
            Else
                Get_BOL_Orders = Build_String_From_Rs(rs)
            End If
    
            rs.close()
            cn.close()
    
        End Function
    
    NOTE! The SQL Express code is almost identical to the DB2 Code because SQL and ODBC and standards that work with both databases. Sample Connection String in the Web.config file
    <add name="iSeries" connectionString="DRIVER={Client Access ODBC Driver (32-bit)};system=###.###.###.###;UID=<user id>;PWD=<password>;dbq=<iSeries Library>;nam=1;conntype=0;translate=1;" providerName="System.Data.Odbc"/>
    
    Where: ###.###.###.### is the IP address of the iSeries <user id> is the iSeries User Profile you want to use to access the data <password> is the iSeries User Profile's password <iSeries Library> is the iSeries Library that contains your file/table Build an HTML Table from a Record Set (either from SQL or DB2 - it doesn't matter)
    Function Build_Table_From_Rs(ByRef rs As Object) As String
    
            Dim i As Integer
            Dim sTable As String
            Const sTab1 As String = "          "
            Const sTab2 As String = "            "
            Const sTab3 As String = "              "
            Const sTab4 As String = "                "
            Const sClass As String = "class=""data-row"""
    
            'Header
            sTable = vbCr
            If Not rs.eof Then
                sTable = sTable & sTab1 & "<table cellspacing=""0"" class=""data"" >"
                sTable = sTable & sTab2 & "<thead>" & vbCr
                sTable = sTable & sTab3 & "<tr>" & vbCr
                For i = 0 To rs.fields.count - 1
                    sTable = sTable & sTab4 & "<th>"
                    sTable = sTable & Trim(rs(i).name)
                    sTable = sTable & "</th>" & vbCr
                Next
                sTable = sTable & sTab3 & "</tr>" & vbCr
                sTable = sTable & sTab2 & "</thead>" & vbCr
    
                'Body
                sTable = sTable & sTab2 & "<tbody>" & vbCr
                Do Until rs.EOF
                    If Not rs.eof Then
                        sTable = sTable & sTab3 & "<tr>" & vbCr
                        For i = 0 To rs.fields.count - 1
                            sTable = sTable & sTab4 & "<td " & sClass & ">"
                            sTable = sTable & Trim(rs(i).value)
                            sTable = sTable & "</td>" & vbCr
                        Next
                        sTable = sTable & sTab3 & "</tr>" & vbCr
                        rs.MoveNext()
                    End If
                Loop
                sTable = sTable & sTab2 & "</tbody>" & vbCr
                sTable = sTable & sTab1 & "</table>" & vbCr
            End If
    
            Build_Table_From_Rs = sTable
    
        End Function
    
    1,610 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following