Importing and exporting data using the RdbmsNetwork

Each of the following Rdbms Device extensions has an associated History Device Extension Graphic that you can configure and use to perform exports and imports of data between Rdbms database and NiagaraAX history files:

You can use the History Import Manager or History Export Manager views to specify, configure, and execute the importing or exporting of files. For more detailed information about these views and importing and exporting histories, in general, refer to the “History Import Manager” and “History Export Manager” sections of the NiagaraAX-3.x Drivers Guide.

The following procedures describe how to import and export data between an Rdbms database and history files:

    Export history data to an Rdbms database

    This procedure describes how to export history data to any of the following Rdbms database types:

    • Db2
    • MySQL
    • Oracle
    • SqlServer

    The term rdbDatabase in the following steps, refers to any of the database types listed above.

    To export history data to an Rdbms database, do the following:

  1. In WorkbenchAX, establish a connection to the desired database, as described in Installing the RdbmsNetwork driver and rdbDatabase device.
  2. In the WorkbenchAX nav tree, under the station DriversRdbmsNetworkrdbDatabase node, double-click on the Histories Graphic node. The History Export Manager view displays.
  3. Click the New button at the bottom of the History Export Manager view. The New dialog box displays.
     
    NOTE: As an alternative to the New button and dialog box, you can click the Discover button and browse to find and select the desired history file to export.
     
  4. From the New dialog box, select the desired rdbDatabase type from the “Type to Add” option list and type in the number of export descriptors to add in the “Number to Add” field.
     
    NOTE: You need to add one unique export descriptor for each history file that you want to export.
     

    Click the OK button. A second New dialog box appears with one or more export descriptors in the top pane.

  5. In the New dialog box, edit the following fields and click the OK button:
    • Name

      Type in a meaningful name for this export descriptor.

    • History Id

      Enter the station name and history name into these two fields

    • Execution Time

      Select an execution mode from the option list. For Daily or Interval modes, choose the desired execution parameters for the specific mode.

       
      NOTE: If you are handling large volumes of data it is good practice to make use of the Randomization option when setting Execution Time, to offset the data exports.
       
    • Enabled

      Select true to enable or false to leave the export descriptor disabled.

    The new history export descriptor(s) appears in the Database (lower) pane.

  6. Initiate an export action by doing any one of the following:
    • Select one or more history descriptors in the database pane and click the Archive button.
    • Right-click on a single history descriptor in the database pane and select Actions Execute.
    • Using the Daily or Interval settings, as set in the New or Edit dialog box, allow the export to occur, as scheduled.

    The status and time of the last export action is displayed in the Database pane, “Status” and “Last Success” columns, respectively. Also, each export descriptor appears under the rdbmsDatabase Histories node in the nav tree.

    Import history data to an Rdbms database

    This procedure describes how to import history data to any of the following Rdbms database types:

    • Db2
    • MySQL
    • Oracle
    • SqlServer

    In the following steps, the term rdbDatabase refers to any of the database types listed above.

    To import history data into an Rdbms database, do the following:

  1. In WorkbenchAX, establish a connection to the desired database, as described in Installing the RdbmsNetwork driver and rdbDatabase device.
  2. In the WorkbenchAX nav tree, under the station DriversRdbmsNetworkrdbDatabase, right-click on the Histories Graphic node and select Views Rdbms History Import Manager. The Rdbms History Import Manager view displays.
  3. Click the New button at the bottom of the Rdbms History Import Manager view. The New dialog box displays.
     
    NOTE: As an alternative to using the New button and dialog box, you can click the Discover button to populate the Discovered pane with available data tables, then select the desired tables and click the Add button at the bottom of the view. In this case an Add dialog displays that is similar to the New dialog box, described in Step 6, below.
     
  4. From the New dialog box, select Rdb History Import from the “Type to Add” option list and type in the number of import descriptors to add in the “Number to Add” field.
     
    NOTE: You need to add one unique import descriptor for each history file that you want to import. If you used the Discover and Add buttons to populate the Discovered pane, then you do not see this dialog box.
     
  5. Click the OK button. A second New dialog box appears with one or more import descriptors in the top pane.
  6. In the New dialog box, edit the following fields and click the OK button:
     
    NOTE: If you used the Discover and Add buttons instead of the New button, you are using the Add dialog box in this step and the Name and History Id fields are already filled in.
     
    • Name

      Type in a meaningful name for each import descriptor.

    • History Id

      Enter a station name and history name into these two fields.

    • Execution Time

      Select an execution mode from the option list. For Daily or Interval modes, choose the desired execution parameters for the specific mode.

    • Enabled

      Select true to enable or false to leave the import descriptor disabled.

    • Capacity

      Set the desired maximum number of records to import.

    • Full Policy

      This property allows you to choose what to do when the Capacity number is reached. The Roll option drops off the oldest record to make room for the newest record. The Stop option simply causes the history to stop recording.

    • Interval

      This option allows you to choose between the following two options for setting a data import frequency.

      • irregular

        This option does not specify a particular frequency for imports.

      • regular

        This option allows you to set an import action frequency in terms of hours, minutes, and seconds.

    • Value Facets

      This property allows you to set units for the “Value Column” in the imported table.

    • Time Zone

      Use this property to set the desired import-location time zone.

    • Rdb Table Name

      Type in the name or click on the search and replace icon to use the Batch Search and Replace dialog box to redefine the table name on import.

    • Rdb Catalog Name

      Type in the name or click on the search and replace icon to use the Batch Search and Replace dialog box to redefine the catalog name on import.

    • Rdb Schema Name

      Type in the name or click on the search and replace icon to use the Batch Search and Replace dialog box to redefine the schema name on import.

    • Timestamp Column

      Specify the Timestamp column for the imported data. If you did a Discover, then the table columns are displayed in the option list for you to choose from. Otherwise, type in the column name in the text field.

    • Value Column

      Specify the Value column for the imported data. If you did a Discover, then the table columns are displayed in the option list for you to choose from. Otherwise, type in the column name in the text field.

    • Status Column

      Select or clear the option box to specify if a status column is included in the imported data or not. If the None box is cleared, then specify the status column for the imported data. If you did a Discover, then the table columns are displayed in the option list for you to choose from. Otherwise, type in the column name in the text field.

    • Query Predicate

      This field allows you to insert a query predicate to filter the records that are imported. For example, you could type in “where Value > 100” to import only those records that have a “Value” that is greater than 100. Or, you could type in “where Value between 1 and 100” to import those records with Values between 1 and 100.

    • Full Import On Execute

      Select Enabled to import the full database (up to the specified limit) on each successive import action. Select Disabled to import (and append) only the new data on each successive import action.

    After clicking the OK button, the new history import descriptor(s) appears in the Database (lower) pane.

  7. Initiate an import action by doing one of the following:
    • Select one or more history descriptors in the database pane and click the Archive button.
    • Right-click on a single history descriptor in the database pane and select Actions Execute.
    • Using the Daily or Interval settings, as set in the New or Edit dialog box, allow the import to occur, as scheduled.

    The status and time of the last import action is displayed in the Database pane, “Status” and “Last Success” columns, respectively. In addition, the imported histories appear in the nav tree under the History Graphic node, organized by device Graphic.