The licensing for DB2 Personal Edition is
1 machine, one developer - no remote clients.

As for connecting, you can use iODBC, or
unixODBC for "real" programs. When you use PHP and compile --with-ibm-db2 you'll get
"ODBC calls which map and make DB2 CLI calls under the covers" and you'll bypass ODBC and
the performance hit associated with ODBC vs.
DB2 CLI. ie, odbc_connect() in PHP LOOKS like ODBC, but it really makes DB2 CLI calls
and doesn't need/use/require ODBC at all.

'Luck!

-Szii

    Thanks for the reply. So why is it giving me
    a licence not valid......I'm "trying" to connect to a AS400 remotely from a linux box with apache and php. The ibm-db2 switch with php seems to work as phpinfo reports it so.

    If I can't get DB2 CLI to work then iODBC might be the way. But then do i compile php with ibm-db2 and iODBC support?....and is the ODBC for linux driver in the Personall Edition of DB2 included?

    thanks
    marios

      Erg, this is really getting annoying.

      Okay, LAST TIME!

      --with-ibm-db2 DOES NOT USE ODBC!
      When you say "odbc_connect()" IT DOES NOT
      USE ODBC! PERIOD! YOU say "ocbc_connect()"
      and IT says "CLIConnect!"

      The function NAMES say odbc_xxxx but
      it's NOT USING ODBC!

      Setup DB2Connect on your remote machine,
      run the "db2 catalog" commands, and
      use TCP/IP to talk to the AS400! You don't
      need iODBC/unixODBC/etc at all.

      Do a search in the DB2 docs...there's a whole DRDA section about communications between client yyyy and an AS400.

      Peace, love, code.

      -Szii

        On the subject of licensing, the Personal Edition does not allow for remote clients.
        (At least that's my interpretation of the
        DB2 site.) There's a db2licm executable
        somewhere on your CD. That same CD should
        contain the license itself. Use the db2licm
        to add the license from the CD.

        'Luck!

        -Szii

          3 months later

          Original Message:

          Author: Kirk Parker (209.191.185.54)
          Date: 2000-12-29 02:01:50

          The IBM-supplied Client Access ODBC drivers for NT work fine, and I've used them a fair amount, but I couldn't fine anything for Linux that really provided AS/400 connectivity.

          Hello Kirk,

          I'm trying to do the same,
          Could you please tell me how you did it through ODBC with Client Access.

          HAVE YOU SOME CODE EXAMPLE.

          Thanks.

          Alim.

            6 months later

            Mario,

            Were you able to resolve this probelm regarding the licence issue.

            I'm at the same point myself and haven't found the answer

            -Paul

              I reinstalled everything and did the whole procedure again.

              Didn't need a license key. I assume it had to do with the commands entered to via CLI to connect to DB2. Review the commands entered, otherwise I've written a small recipe to get this to work from my experience, might help, mail me privately if you would like me to send it you.

              marios

                The LicenseError message should not occur - if it happens, it means you have installed the DB2 portion incorrectly. There is a VERY GOOD tutorial at: http://www.e-gineer.com/instructions/installing-ibm-db2-for-php4x-with-apache13x-on-linux.phtml

                I have (after much trouble-shooting) - installed Apache/PHP4/DB2connect - on RedHat6.2 - and Im going through a Firewall to a corporate AS400 - passing data back and forth in real-time for a commercial web application. It works fine. the instructions found at the tutorial above were a big help.

                If you follow the tutorial above and still have a major problem, post here and I will try to help you out.
                -Ken

                  Ken,

                  I've tried using the mentioned tutorial...

                  I can connect to the sample database that I create with db2 on my linux box but when I try to connect to a remote AS/400 box I get the Licence error.

                  I planning on removing the DB2 connect software again and trying from scratch.

                  From what I can tell the AS/400 side is configured properly. I can connect to it from a Win 2000 box running apache and php. Using the IBM ODBC connect driver.

                    Paul - if you intend to use the FREE DB2connect client - You CANNOT install the DB2 server product on the same machine - that is why you will get the license error. You must delete ALL DB2 software and install only the DB2connect software.
                    =-=-=-=-=-=-=-=-=-=-=-=-=-=
                    Here is an install tutorial for the DB2 part
                    Note: I made the AS400 user account/login to match the db2inst1 user on the linux machine.

                    Thanks to: Derek Piper for this info.

                    IBM AS/400 DB2 Connect to Linux Apache/PHP

                    Install DB2 Connect Personal (or Enterprise) Edition on Linux WWW machine.

                    Compile PHP with DB2 Support (for appropriate version - the example given is for version 7.1).

                    Add this option to your PHP compile options

                    --with-ibm-db2=/usr/IBMdb2/7.1/include/

                    Create DB2 Instance on Linux machine. Use the 'db2setup' command in the 'install' subdirectory of the DB2 Connect installation. Set up the account but not with the given defaults, pick an original password at least.

                    user db2as400
                    password ?????

                    Set up a user on the AS/400 and keep username and password for later to use in place of [as400user] and [as400pass]. Set that user's CCSID to '037' (for USA), do not leave it at 65535 (possibly system default). Make sure permissions are correct for any tables that need to be read or written to.

                    Configure DB2 Instance by logging into Linux machine as DB2 user and password (as defined above) (or by su'ing from root to db2 account). Use command 'db2' to enter command line processor. From there, type (on one line per statement):

                    Items in [] are the user definable settings - don't include the [], just make up different names that are unique based on what is required.

                    Variables:

                    [localName] The local name you want to call this instance
                    [as400Addr] IP Address of your AS/400
                    [youras400DB] Regular host name of your AS/400
                    [as400DB] What you want to call the AS/400 on the DB2/Linux side
                    [DSN] What you plan to have as the ODBC DSN within PHP
                    [as400user] User with adequate permissions and CCSID*
                    [as400pass] Password of user

                    • CCSID is for character handling, you might want to set this to 037 for [as400user] and use the command below with BIDI in. Incorrect settings on eithe end can mean you can't log in even if the password is correct.

                    Commands (enter step-by-step on one line):

                    catalog tcpip node asnode remote 209.27.120.134 server 446
                    catalog tcpip node [localName] remote [as400Addr] server 446 remote instance [youras400] system www ostype OS400

                    catalog dcs database [as400DB] as [youras400] parms ",,,,,,,,BIDI=037"

                    catalog database [as400DB] as [DSN] at node [localName] authentication DCS

                    connect to [DSN] user [as400user] using [as400pass]

                    bind /usr/IBMdb2/V7.1/bnd/@ddcs400.lst BLOCKING ALL SQLERROR CONTINUE MESSAGES DDCS400.MGS GRANT PUBLIC

                    connect reset

                    terminate

                      Ken,

                      catalog tcpip node asnode remote 209.27.120.134 server 446

                      is the above line correct ro am I suppost so substitue my own values for asnode and the IP address entered.

                      I've tried it both ways now and when I try to connect I get an SQL10012N error: unexpeced opperation in library libddcs.a

                        6 days later

                        JC and Paul - Here are the directions again:

                        DO NOT install IBM DB2 Linux Personal Edition !!! - if you want to talk TO an AS400 FROM a linux box - you must ONLY INSTALL DB2 Connect Personal Edition for Linux !!!
                        (NOTE: You can only install the Connect Client on the machine you want to use to connect to the AS400)

                        Otherwise you will get the license error and you will never be able to connect to the AS400.

                        Refer to my previous post where I clearly explained exactly what to do:
                        http://www.phpbuilder.com/forum/read.php3?num=5&id=20142&thread=5567

                        Obviously, you will replace any IP's in the directions with your own, and any AS400 Names/Node Names with your own.

                        The IBM DB2 Connect Personal Edition Getting Started PDF doc is pretty clear on the process - if these instructions dont help you, then you will have to RTFM.

                          3 months later

                          Hi,

                          I have search IBM website, just DB2 Personal Edition are available for download, Where i can download the DB2 connect personal edition.

                          Thanks

                          Vincent

                            you need to register now apparently, to get a license for it. Odd, before you basically just downloaded it. Dont remember being a licensing issue with db2 connect

                            Marios

                              6 months later

                              I entered step-by-step the commands but the last one (the bind command) returned me this message : 'SQL0035N The file "DDCS400.MGS" cannot be opened.'
                              Could anybody help me ?
                              Thanks

                                22 days later

                                Can I get the Apache server on the AS/400 to run PHP and connect to DB2 on same machine?

                                Anyone know?

                                Thanks!

                                  2 months later

                                  Ok guys, after searching for what seemed like forever, and experiencing all the issues that you guys seem to have experienced (where to get DB2Connect, etc). I've finally found some useful information.

                                  http://www.redbooks.ibm.com/redpieces/pdfs/sg246551.pdf

                                  Here's a link to the iSeries ODBC driver:
                                  http://www-1.ibm.com/servers/eserver/iseries/linux/odbc/

                                  The PDF is shows step-by-step how to configure apache, linux, odbc, and the 400. In addition it has code samples in perl and php.

                                  It's a great resource, and it helped me finally accomplish my goal. Hopefully, it will save someone else from having to go through what I went through.

                                  Cheers,
                                  CB

                                    8 months later

                                    Hi,
                                    I'm tryng to do the same connection. I have an As400 (os400 v4.5), a Windows 2000 server with IIS, php 4.3.1. I try to use "Client Access odbc driver" provided by IBM. When I try to connect to the database, the web page still blank. I've opened an incident at IBM support, but I've no response.
                                    I think I'll try with DB2 connect instead of Client access odbc driver.
                                    if you have some news (good one) could you send me a mail at j-pierre.clutier@icm46.org
                                    if I have some news I can send you by give me your adress please.
                                    JPC

                                      It's OK now. I tried to do it with client acess express v4.5. Yesterday I've updated the version up to 5.1. And now it's OK.
                                      JP Clutier
                                      If you want some more information j-pierre.clutier@icm46.org

                                        Write a Reply...