The Database Configuration File

The database configuration file (by default, named MFDBFH.cfg) is used by the native database file handler (MFDBFH), and for enterprise server region management.

It contains a list of database server instances, the databases available within them, and connection details. The types of database server currently supported are Microsoft SQL Server and Azure database, PostgreSQL, Db2, and Oracle. You may have one or more instances of each type configured within the same configuration file.

Within each server instance element, you configure a <dsn> element for each database available. Databases are either of type database, datastore, region.cas, or crossregion.cas; see Types of Database for more information.

To create or edit the configuration file, Micro Focus recommends that you use the dbfhconfig command line utility, and also that you enable the configuration file to use a secrets vault, so that the database connection credentials can be stored securely, behind an encryption process; see Configure a Secrets Vault for the Micro Focus Database File Handler.

MFDBFH or Enterprise Server establishes connection with a database using either a corresponding ODBC data source configured on your machine, or through a direct connection string (see Database Connection Strings).

See the Update the Configuration File for <db-type> topic in the relevant Configuring Datastores or Configuring Region and Cross-Region Databases sections for full details.

The following example shows server entries for each of the supported database providers: one of type sqlserver (called svr-mysqldb), one of type azuresqldb (whose location is determined by an environment variable), one of type postgresql (which stores its datastores, region database, and cross-region database in a single physical database - MFDevDB), one of type Db2 (which again, uses a variable), and the final server entry is type oracle. The first three use the ODBC data source names configured, but the last two (Db2 and Oracle) specify direct connection details via the connect option.

<datastores usevault="true">
  <server name="svr-mysqldb" type="sqlserver" access="odbc">
    <dsn name="SS.MYMASTER" type="database" dbname="master"/>
    <dsn name="SS.VSAM" type="datastore" dsname="VSAM" dbname="VSAM"/>
    <dsn name="SS.CAS.ESDEMO" type="region.cas" region="ESDEMO" dbname="ESDEMO" feature="all"/>
    <dsn name="SS.CROSSREGION" type="crossregion.cas" dbname="_$XREGN$"/></server>
  <server name="${VAR2AZDB}" type="azuresqldb" access="odbc">
    <dsn name="AZ.MYMASTER" type="database" dbname="master" userid="azusr" password="$$vault$$"/>
    <dsn name="AZ.VSAM" type="datastore" dsname="VSAM" dbname="VSAM" userid="azusr" password="$$vault$$"/>
    <dsn name="AZ.SEQ" type="datastore" dsname="SEQ" dbname="SEQ" optio="+ooseq" userid="azusr" password="$$vault$$"/>
    <dsn name="AZ.CAS.ESDEMO" type="region.cas" region="ESDEMO" dbname="ESDEMO" feature="all" userid="azusr" password="$$vault$$"/>
    <dsn name="AZ.CROSSREGION" type="crossregion.cas" dbname="_$XREGN$" userid="azusr" password="$$vault$$"/></server>
  <server name="MFDevDB" type="postgresql" access="odbc">
    <dsn name="PG.POSTGRES" type="database" dbname="postgres"/>
    <dsn name="PG.VSAM1" type="datastore" dsname="PGVSAM1" dbname="MFDevDB" userid="clerk" password="$$vault$$"/>
    <dsn name="PG.VSAM2" type="datastore" dsname="PGVSAM2" dbname="MFDevDB" userid="clerk" password="$$vault$$"/>
    <dsn name="PG.CAS.PGDEMO" type="region.cas" region="PGDEMO" dbname="MFDevDB" feature="all" userid="clerk" password="$$vault$$"/>
    <dsn name="PG.CROSSREGION" type="crossregion.cas" dbname=""MFDevDB" userid="clerk" password="$$vault$$"/></server>
  <server name="${TESTMFDBFH_DBINST_DB2}" type="db2" access="odbc">
    <dsn name="DB2.COPYTEST" type="datastore" dsname="COPYTEST" optio="all -ooseq" connect="$$vault$$"/>
    <dsn name="DB2.VSAM" type="datastore" dsname="VSAM" optio="all -ooseq" connect="$$vault$$"/>
    <dsn name="DB2.CAS.CROSSREGION" type="crossregion.cas" optio="none" connect="$$vault$$"/>
    <dsn name="DB2.CAS.TESTDB" type="region.cas" region="TESTDB" connect="$$vault$$"/></server>
  <server name="MY_ORA_DB" type="oracle" access="oci">
    <dsn name="ORA.VSAM" type="datastore" dsname="VSAM" optio="none" dbname="DBFHTEST" userid="mfdbfh" password="temppwd"/>
    <dsn name="ORA.JES" type="datastore" dsname="JES" optio="none" dbname="DBFHTEST" userid="mfdbfh" password="temppwd"/>
    <dsn name="ORA.CAS.CROSSREGION" type="crossregion.cas" dbname="DBFHTEST" connect="mfdbfh/temppwd@DBFHTEST"/>
    <dsn name="ORA.CAS.TESTDB" type="region.cas" region="TESTDB" dbname="DBFHTEST" connect="mfdbfh/temppwd@DBFHTEST"/></server>
</datastores>

Each instance has a number of datastore, region, and cross-region databases. The sqlserver, azuresqldb, and postgresql server instances include an entry for type=database; this is mandatory in order for MFDBFH or Enterprise Server to be able to interact with those instances.

Use the MFDBFH_CONFIG environment variable to locate this configuration file, both when running applications through Enterprise Server and when using the dbfh* command line utilities. If the variable is not set, the configuration file is assumed to be located in the current directory, or in the enterprise server region's system directory; alternatively, these utilities can specify a configuration file (-configfile option), which will override the variable setting.