Prepare the runtime environment - connecting to the database

  1. Genero BDL provides several database drivers based on different ODBC clients. This list describes each of them:
    • For Windows™ platforms, use the SNC database driver based on SQL Native Client ODBC driver (SQLNCLI.DLL) for Microsoft™ SQL SERVER 2005 and higher.

      The SNC driver is supported starting from Genero 2.10.

    • For Unix platforms, Genero supports the FTM driver is based on the FreeTDS ODBC client ( www.freetds.org).

      This driver can be used with FreeTDS to connect from a UNIX™ platform to a Windows platform running SQL SERVER.

      You need at least FreeTDS version 0.83.

      The FTM driver is supported starting from Genero 2.11.

    • For Unix platforms, Genero supports the ESM driver is based on the EasySoft ODBC driver for SQL Server ( www.easysoft.com).

      This driver can be used with EasySoft to connect from a UNIX platform to a Windows platform running SQL SERVER.

      You need at least EasySoft version 1.2.3.

      The ESM driver is supported starting from Genero 2.21.

  2. Check that the Genero distribution package has installed the SQL SERVER database driver you need (i.e. a "dbmsnc*", "dbmftm*" or "dbmesm*" driver must exist in FGLDIR/dbdrivers.
  3. An ODBC data source must be configured to allow the BDL program to establish connections to SQL SERVER. Make sure you select the correct ODBC driver ( SNC = "SQL Native Client", FTM = "FreeTDS", ESM = "EasySoft").
    Important: When using the FTM (FreeTDS) or ESM (EasySoft) database driver, you have to define the ODBCINI and ODBCINST environment variable to point to the odbc.ini and odbcinst.ini files.
  4. Install and configure the database client software:
    1. When using the SNC database driver, you must have the Microsoft SQL SERVER Native Client software installed on the computer running Genero applications.

      Since the SNC driver is using ODBC32.DLL, there is no need to set the PATH environment variable to a specific database client library path.

      The database client locale is defined by the regional settings of the application server and must match the locale used by the BDL application. Character set conversion (current code set <=> Wide-Char) is done by the SNC ODI driver according to the LANG environment variable. If the LANG environment variable is not defined, the application character set defaults to the ANSI code page (ACP).

    2. When using the FTM database driver, you must install FreeTDS ( www.freetds.org ).

      Make sure the FreeTDS environment variables are properly set. Check for example FREETDS (the path to the configuration file). See FreeTDS documentation for more details.

      With the FTM driver, there is no need to install a driver manager like unixODBC: The FTM database driver is linked directly with the libtdsodbc.so shared library. Verify the environment variable defining the search path for that database client shared library. 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 .

      You must create the odbc.ini and odbcinst.ini files to defined the data source.

      Do not forget to define the client character set for FreeTDS (client charset parameter in freetds.conf or ClientCharset parameter in odbc.ini). You may need to link FreeTDS with the libiconv library to support character set conversions.

      You must set the TDS protocol version according to the SQL Server version (2005, 2008, etc), by setting the tds version parameter in freetds.conf or TDS_Version in odbc.ini. For example, when using SQL Server 2005 and 2008, you must use the TDS protocol version 8.0 or higher.

      See FreeTDS documentation for more details about installation and data source configuration in ODBC files.

    3. When using the ESM database driver, you must install EasySoft ODBC for SQL Server (www.easysoft.com).

      Make sure the EasySoft environment variables are properly set. Check for example EASYSOFT_ROOT (the path to the installation directory). See FreeTDS documentation for more details.

      With the ESM driver, there is no need to install a driver manager like unixODBC: The ESM database driver is linked directly with the libessqlsrv.so shared library. Verify the environment variable defining the search path for that database client shared library. 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 .

      You must create the odbc.ini and odbcinst.ini files to defined the data source.

      Do not forget to define the client character set for EasySoft with the Client_CSet parameter in odbc.ini. The client character set is an iconv name and must match the locale of your Genero application.

      When using CHAR/VARCHAR types in the database and when the database collation is different from the client locale, you must also set the Server_CSet parameter to an iconv name corresponding to the database collation. For example, if Client_CSet=BIG5 and the db collation is Chinese_Taiwan_Stroke_BIN, you must set Server_CSet=BIG5HKSCS, otherwise invalid data will be returned from the server.

      You must also set the following DSN parameters:

      AnsiNPW=Yes
      Mars_Connection=No
      QuotedId=No

      See EasySoft documentation for more details about installation and data source configuration in ODBC files.

  5. On Windows platforms, BDL programs are executed in a CONSOLE environment, not a GUI environment. CONSOLE and GUI environments may use different code pages on your system. Start the SQL SERVER Configuration Manager to setup your client environment and make sure no wrong character conversion occurs. See Microsoft SQL SERVER documentation for more details.
  6. Set up the fglprofile entries for database connections.
    Important: Make sure that you are using the ODI driver corresponding to the database client and server version. Because Informix® features emulation are dependant from the database server version, it is mandatory to use the same version of the database client and ODI driver as the server version.

    You may want to set the logintime parameter to change the default login timeout period, increase the prefetch.rows parameter to get better performances with result sets, etc.

    With the SNC driver you might consider setting the snc.widechar FGLPROFILE parameter to false if your database columns are defined with the CHAR/VARCHAR/TEXT types (by default the driver is prepared to work with the "UNICODE" types NCHAR/NVARCHAR/NTEXT). See CHARACTER data types for more details.