EGL Development User Group

EGL Development User Group

EGL Development User Group

The EGL Development User Group is dedicated to sharing news, knowledge, and insights regarding the EGL language and Business Developer product. Consisting of IBMers, HCL, and users, this community collaborates to advance the EGL ecosystem.

 View Only
Expand all | Collapse all

Switching between datebase connections

  • 1.  Switching between datebase connections

    Posted Mon September 09, 2019 02:15 PM

    What would be the best method to switch between database connections. For example, im creating an application that will be pointing to iseries DB and an SQL server.

    During development stage, i would like an easy way to switch between the two. After deployment, i would only be pointing to one.

    Any suggestions?

    nick_tn


  • 2.  Re: Switching between datebase connections

    Posted Tue September 10, 2019 08:37 AM

    Hi Nick,

    I supose you are genned to Java then I could suggest bellow:

    1. You must be have a main DB Connect defined in generated option.

    2. To define when you have a second DB2 Connect.

         2.1. Add a new parameter in your rununit.properties, exemple:

               my.second.dbconnect=SQLSERVER

         2.2. On egl stmt get this parameter

                mySecondDb string = sysLib.getProperty("my.second.dbconnect");

         2.3. Use this new variable to choose which DB Connect do you want

                if (mySecondDb == "SQLSERVER")

                   connect to sqlserver

               else;

                   connect otherwise

                end;

    I hope help you.

     

    Regards,

    Hsieh

     

     

    Hsieh


  • 3.  Re: Switching between datebase connections

    Posted Wed September 11, 2019 05:36 PM

    Thanks. I will give that a try.

    nick_tn