Step 1: Create an ODBC Data Source Name (DSN)
CA Gen GUI applications are 32 bit so the DSN needs to be created using the 32 bit ODBC.
-If you are using a 32 bit version of Windows, open the Control Panel, locate and execute “Set up data sources (ODBC)”.
-If you are using a 64 bit version of Windows, execute “C:\Windows\SysWOW64\odbcad32.exe”.
User DSNs will be available only to the user that creates the DSN. System DSNs are available to all users.
The name that is used for the DSN must match the database name in Technical Design.
Step 2: CA Gen Toolset Tasks
Some of the databases supported by Gen can be accessed by ODBC or embedded SQL. The following are steps needed to set your database to use ODBC. This procedure assumes that you have Technical Design set up and a database already installed.
-Select Design, Technical Design, choose your database, Detail, Properties. In the DBMS Access Method, choose ODBC/ADO.NET/JDBC.
Generate the GUI application.
-Select Construction, Generation, Options, and then Generation Defaults. In the DBMS (TD) option, select the database as you did in the previous step. Selecting the database tells the generator to use the table and column names that are in your database TD.
-Generate the load module.
Step 3: CA Gen Build Tool Tasks
Select the load module and click the Test push button. When the first database access action diagram statement is executed, a Select Data Source window will appear and allow you to select the DSN for your database. Depending on your database, there may be another pop up box that will prompt for a database user ID and password that must be filled in to connect.
Step 4: Automating the database connection
You can be prompted to select the DSN each time you run your application or you can modify the IEFGDIC.INI file. Modifying the IEFGDIC.INI file allows you to bypass being prompted for DSN. The default location for the IEFGDIC.INI file is the C:\Users\<YourID>\AppData\Local\CA\Gen 8.5\cfg\client directory.
-Below is an example where there is just one database entry.
Your IEFGDIC.INI may have multiple entries that already exist. If so, increase the DatabaseCount and then add a section at the bottom with name of the fields to the next number in sequence. For example, change DatabaseCount=2 and add a section with Database2, Trancode2, LoadModule2, Server2, SQLid2 and SQLPassword2.