Create a Datastore and Upload a File to a Db2 Datastore

Attention: This feature is in Early Adopter Product (EAP) release status. We will continue the development of additional features and provide additional interfaces via patch updates and future releases. Please contact Micro Focus SupportLine if you require further clarification.

Use these steps to create Db2 datastores if you have not already created them using the scripts mentioned in Create Datastore Scripts for Db2.

  1. Open an Enterprise Developer command prompt.
    Note: On Windows, the command prompt must be the same bitism as the ODBC data source that you intend to use.
  2. Set the MFDBFH_CONFIG environment variable to locate the MFDBFH.cfg file that contains a reference to the data source:
    set MFDBFH_CONFIG=<location-and-name-of-file>

    If you do not set this variable, the file is assumed to be located in the current directory.

    Note: The MFDBFH_SCRIPT_DIR environment variable is also required to point to the stored procedures used to interact with a datastore; however, this variable is implicitly set already when using an Enterprise Developer command prompt.
  3. If you have not already created the datastore (by running the script file in an earlier step), using the dbfhdeploy command line utility, create the datastore:
    dbfhdeploy data create URL/<datastore-name>

    <datastore-name> must correspond to the name of the data source that you created. For the URL details, see The dbfhdeploy Command Line Utility.

    The datastore database is created, along with a number of default tables and stored procedures.

  4. Add a data file to the datastore:
    dbfhdeploy data add <filename> URL/<file-ref>[?folder=<folder-name>]

    If <folder-name> does not already exist, it is created.

  5. To test that the data file is now in the datastore, you can produce a listing of files and folders in the database using dbfhdeploy:
    dbfhdeploy list URL[?folder=<folder-name>]

    A list of files is displayed.

    Note: If you do not specify a folder name, only files and folders at the base level of the datastore are displayed.