Gen GUI C application ODBC Connectivity
search cancel

Gen GUI C application ODBC Connectivity

book

Article ID: 27839

calendar_today

Updated On:

Products

Gen Gen - Workstation Toolset

Issue/Introduction

This article will help application developers configure a Gen C application (GUI client or server) to access a database via Open Database Connectivity (ODBC).

Environment

Gen GUI C applications

Resolution

Create an ODBC Data Source Name (DSN)

Gen GUI applications are 32 bit so the DSN needs to be created using the 32 bit ODBC program "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 the Gen model Technical Design.


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 the database to use ODBC. This procedure assumes that the Technical Design has been set up and a database already installed.  

  • Select Design, Technical Design, choose the 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 per the previous step. Selecting the database tells the generator to use the table and column names that are in the database Technical Design.

  • Generate the load module.


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 selection of the DSN for the database. Depending on the 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.


Automating the database connection

The user will be prompted to select the DSN each time the application is run. Alternatively modify the iefgdic.ini file to bypass the prompt.
The default location for the  iefgdic.ini file is the directory "%USERPROFILE%\AppData\Local\CA\Gen 8.6\cfg\client".
The  iefgdic.ini file 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.
Below is an example where there is just one database entry:

[MaxDatabases]
Max=100
[ODBC]
DatabaseCount=1x`
Database1=SAMPLE
Trancode1=
LoadModule1=
Server1=SAMPLE
SQLid1=userid
SQLPassword1=password
 

Additional Information