Skip to main content
Dominique Sacre
Rocketeer
Jul 7, 2012 12:53 PM UTC

Connect and use DB2 database in COBOL project

Hi all,

I working on project in Net Express 5.0

where I need to work with a data base created with IBM DB2 (v 9.7) .

Does any one know how to set up a new project and connect a data base created with DB2 step by step ?

Thanks a lot !

    3 replies

    Chris Glazier
    Moderator
    Jul 7, 2012 6:22 PM UTC

    Hi all,

    I working on project in Net Express 5.0

    where I need to work with a data base created with IBM DB2 (v 9.7) .

    Does any one know how to set up a new project and connect a data base created with DB2 step by step ?

    Thanks a lot !

    Look in the documentation under Database Access-->DB2 if you are using the DB2 External Compiler Module (ECM). This method uses the DB2 directive to cause the compiler to make calls to the IBM precompiler APIs to expand the EXEC SQL statements into calls to DB2.
    You will have to install the IBM DB2 Client tools in order to use this directive.

    The documentation can be found here: http://supportline.microfocus.com/documentation/books/nx50ws03/dbedb2.htm

    There some examples in the folder C:\\Program Files\\Micro Focus\\Net Express 5.1\\Examples\\Net Express IDE\\DB2ESQL.
    It is advisable to try to get one of these simple examples such as CONNECT to run with the DB2 sample database before you try this on your own applications just to ensure that the DB2 environment is setup correctly.

    It is also possible to use an ODBC driver to connect to DB2.
    If you plan to go that route then you should look at the documentation section for the OpenESQL precompiler instead at http://supportline.microfocus.com/documentation/books/nx50ws03/dbesql.htm

     

    Dominique Sacre
    Rocketeer
    Jul 7, 2012 10:00 PM UTC

    Hi all,

    I working on project in Net Express 5.0

    where I need to work with a data base created with IBM DB2 (v 9.7) .

    Does any one know how to set up a new project and connect a data base created with DB2 step by step ?

    Thanks a lot !

    thank you for the answer,

    I opened a project "CONNECT" as you suggested and tried to build it

    this is what I got :

    *****************************************************************************************************************

    Starting rebuild

    Rebuilding         C:\\Program Files\\Micro Focus\\Net Express 5.0\\Examples\\NET Express ide\\DB2ESQL\\CONNECT.CBL

    db2Initialize call failed with = -0000004904

    COBDB0100S SQL4904N  The pointer to parameter "piPidLength v95" of function "sqlainit" is not valid.   : "C:\\Program Files\\Micro Focus\\Net Express 5.0\\Examples\\NET Express ide\\DB2ESQL\\CONNECT.CBL"(1,0)

    Rebuild complete with errors

    ******************************************************************************************************************

    I do have a DB2 9.7 and a SAMPLE database installed,I'm also can connect and use a SAMPLE from DB2

    tools without any problems...

    Chris Glazier
    Moderator
    Jul 8, 2012 5:59 PM UTC

    Hi all,

    I working on project in Net Express 5.0

    where I need to work with a data base created with IBM DB2 (v 9.7) .

    Does any one know how to set up a new project and connect a data base created with DB2 step by step ?

    Thanks a lot !

    Please see the kb article here:

     You should ensure that you have the latest wrappack installed for Net Express 5.0 which is wrappack 5.
    If you have a valid maintenance contract you can download this from the supportline web site here:

    Then add the directive DB2(UDB-VERSION=V95) and it should work OK.

    Thanks.