Inserting data into a table

Use the Graphical Data Mapping editor to insert data into a database table.

Before you begin

You must complete the following task:
  • Create a graphical data map by using the Graphical Data Mapping editor. For information, see Creating a message map.

About this task

To insert a row, or multiple rows, into a database table by using the Graphical Data Mapping editor, complete the following steps:

Procedure

  1. With a graphical data map (.map) file open in the Graphical Data Mapping editor, right-click the canvas, and select Database > Insert into table. Alternatively, select a schema element as an input object, and then click the Insert a row into a database table icon.
    Insert a row into a database table icon
    The Insert wizard is displayed.
  2. In the Database field, select the database that you want to modify. To add a database definition file, or to discover a new database by connecting to a database server, click Add database.... For more information, see Creating a database definition (.dbm file) by using the New Database Definition File wizard.
    To use a different database name at run time, you can override this value by setting the Name of the database property of the JDBC Providers policy that connects to your database; see JDBC Providers policy (JDBCProviders).
  3. In the Schema field, select the database schema that you want to use to build the transform.
    To use a different database schema at run time, you can override this value by setting the Name of the database schema property of the JDBC Providers policy that connects to your database; see JDBC Providers policy (JDBCProviders).
  4. In the Table field, select the table that you want to modify.
  5. Optional: Select Treat warning as error.
    If this option is selected, the first SQL operation that results in a warning from the selected database raises an exception.
    Important: Database warnings are vendor-specific. For more information about database warnings, see the documentation for your database product.
  6. Click OK.
    An Insert transform and a Return transform are created as a transform group, and are displayed in your graphical data map. The Return transform is an optional transform type. If you do not need to use the Return transform, you can delete it from your graphical data map.
  7. Optional: To replace a Return transform that you deleted from your graphical data map, right-click your Insert transform and select Database > Utilize return.
  8. In the Graphical Data Mapping editor, connect input objects to the Insert transform to define the content of your inserted row.
    • Connect a non-repeating element to the Insert transform to insert a single row into the selected database table.
    • Connect one or more repeating elements to the Insert transform to insert multiple rows into the selected database table. To connect multiple repeating elements, select your repeating elements, then right-click the Insert transform and select Add Connection.
    If you connect a single repeating element, the Insert transform is nested inside a For Each transform. If you connect multiple repeating elements, the Insert transform is nested inside a Join transform. In either case, the nested transform opens so you can continue to edit your Insert transform.
  9. Click the Insert transform to create connections to the columns in your inserted row, and to further define the transform.
  10. Optional: If you need to provide handling for the connected source element being Missing, Empty or Nil, you can set a Database Policy. See Behavior when modifying database column values from optional source elements.
  11. Optional: Connect the Return transform to implement a nested mapping that is called if the Insert operation was completed successfully.
  12. Optional: Click the Return transform to further define the transform.
    A nested map is created, in which you can select the specific transforms that are required for the input and output elements.

What to do next

  • If you want exceptions that are returned from the database server when the SQL operation is run to be handled by the map, instead of having such exceptions stop the map and being reported, you can add a Failure transform into the transform group; see Handling database exceptions in a graphical data map.
  • Set up a JDBC connection to the database that you want to access.