Prepare the runtime environment - connecting to the database

  1. If you want to connect to a remote Genero db server from an application server, you must have ODBC properly configured on your application server.
  2. Make sure the Genero db client environment variables are properly set. Check for example ANTSHOME (the path to the installation directory). See Genero db documentation for more details.
  3. On UNIX™ systems, verify the ODBC environment variables ODBCINI and ODBCINST. These must respectively point to the ODBC Data Source definition file (usually, /etc/odbc.ini) and to the ODBC Database Driver definition file (usually, /etc/odbcinst.ini). You will not be able to connect to Genero db if these environment variables are not set.
  4. Verify the environment variable defining the search path for database client shared libraries (libaodbc.so on UNIX, AODBC.DLL on Windows™). On UNIX platforms, the variable is specific to the operating system. For example, on Solaris and Linux™ systems, it is LD_LIBRARY_PATH, on AIX® it is LIBPATH, or HP/UX it is SHLIB_PATH. On Windows, you define the DLL search path in the PATH environment variable.
    Table 1. Shared library environment setting for Genero db
    Genero db version Shared library environment setting
    Version 3.81 and lower

    UNIX: Add $ANTSHOME/antsodbc (or $ANTSHOME/antsodbc/64 for 64 bit) to LD_LIBRARY_PATH (or its equivalent).

    Windows: Add %ANTSHOME%\antsodbc to PATH.

  5. To verify if the ODBC environment is correct, you can, for example, start the Genero db SQL command interpreter:
    $ antscmd -d dns-name -u appadmin -p password
  6. Set up the fglprofile entries for database connections to your data source.
  7. Starting with the dbmads380 driver, the driver will check for COMPATIBILITY_MODE=INFORMIX at connection time. If you don't want to use this compatibility mode in the server, you can disable the Informix® compatibility mode and bypass this checking in the driver. However, the Genero db server will not behave then like Informix servers in some specific cases, such as date/numeric formatting and conversions, blank padding semantics in string expressions, and locking/concurrency behavior.

    For more details about the SQL features affected by the COMPATIBILITY_MODE parameter, see the Genero db Migration Guide.

    You can use the following FGLPROFILE entry to bypass the compatibility checking:
    dbi.database.dbname.ads.compatibility.check = "none"
  8. Create normal application users and define the schema to be used. Pay attention to the user name, which can be case-sensitive based on the database configuration settings. You can check the names of the database users by querying the system tables (ANTS_ALL_USERS in 3.80).

    With Genero db, a schema is created when creating a user. If the APPADMIN user creates the tables, the schema for application tables will be "APPADMIN".

    In order to make application tables visible to normal DB users, you can specify a default schema for normal users by adding the DEFAULT SCHEMA clause in CREATE USER:
    mydb> CREATE USER username IDENTIFIED BY password DEFAULT SCHEMA appadmin;
    You can also use the following FGLPROFILE entry to make the database driver select a default schema after connection:
    dbi.database.dbname.ads.schema = "name"

    Here <dbname> identifies the database name used in the BDL program ( DATABASE dbname ) and <name> is the schema name to be used.

    If needed, database users can be authenticated as Operating System users. In order to create a DB user authenticated by the operating system, use the IDENTIFIED EXTERNALLY clause in CREATE USER:
    mydb> CREATE USER username IDENTIFIED EXTERNALLY;

    The OS users will be able to connect to the database if the $ANTSHOME/Server/ants.rhosts file contains an entry to identify the OS user.

    See the Genero db documentation for more details about OS users creation.

  9. Grant privileges to application users:
    By default the tables created by the appadmin user cannot be modified by the application users; you must first grant privileges:
    mydb> GRANT SELECT, INSERT, UPDATE, DELETE ON tablename TO username;
    You can do this for all existing and future users by specifying PUBLIC as the grantee:
    mydb> GRANT SELECT, INSERT, UPDATE, DELETE ON tablename TO PUBLIC;

    If the database has stored procedures, you must also grant execute permission to application users:

    mydb> GRANT EXECUTE ON procname TO username;
  10. In order to connect to Genero db, you must have a database driver "dbmads*" in FGLDIR/dbdrivers.
    • If the server is Genero db version 3.61, use the dbmads3x driver.
    • If the server is Genero db version 3.80, use the dbmads380 driver.
    • If the server is Genero db version 3.81, use the dbmads381 driver.
  11. To simplify migration to newer database servers, you can define the driver mode to an older version as the default, and keep using Informix emulations of the old driver (supported starting with Genero BDL 2.20.05):
    dbi.database.dbname.ads.driver.mode = { "3.61" | "3.80" | "3.81" }