ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

Load data from the iSeries

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Load data from the iSeries

    Hello.

    I want to be able to load a table on a web page from data fromt he iSeries.

    I have the following setup:

    - Apache.
    - Tomcat
    - JK connector 2.
    - PHP

    This is all setup on windows 2000 server.

    Can anyone direct me int he correct direction.

    Thanks in advance for any help that you can give me.

  • #2
    Re: Load data from the iSeries

    Do you have IMB's Client Access set up on the server? If you have this then you can use the IBM ODBC or ADO or client access active X (CWBX). There are other methods as well. Some people would just let the I5 serve the page.

    DMW
    Hunting down the future ms. Ex DeadManWalks. *certain restrictions apply

    Comment


    • #3
      Re: Load data from the iSeries

      Thanks for the reply.


      Client access is not setup on the server. I want to retrieve the data using PHP just as I would for MYSQL.


      Bobby.

      Comment


      • #4
        Re: Load data from the iSeries

        This is how I do it with ODBC:
        . First you need to make a connection: $dbconn = odbc_connect("systemID", "userID", "userPassword");

        just to be safe, I usually do a odbc_close_all(); at the beginning of my PHP to ensure no open connections/cursors.

        Now, if you want to update a record, then you need to do this:

        odbc_exec($dbconn, "sql code");

        and if you want to return records you do the this:

        $recordSet = odbc_exec($dbconn, "sql code");

        while (odbc_fetch_into($recordSet, $rowSet)) {
        }

        $rowSet is an array that stores each record you fetch, each field of which is an array element (e.g. $rowSet[0]);

        You can get more info here: http://us3.php.net/odbc_connect

        [EDIT]: I should mention we are running PHP on a linux (SUSE) partition on the AS/400. so... maybe there some other considerations I don't know about . . .

        And also, depending on your settings, commitment control might be an issue. When we ran PHP directly off the AS/400 as a server there, it was. But now that's it's on Linux partition it's not. Basically on the AS/400 side, commitment control was on by default, and on the Linux partition it works in *AUTO mode. So if you don't want commitment control on--if it is on by default, you might have to specify a separate odbc parameter for that. I personally use commitment control very rarely (e.g. need record lock).
        Last edited by pjk; June 30, 2006, 03:43 PM.

        Comment

        Working...
        X