Adding a database mapping input

Before you start:

Before you use any mappings that you create, ensure that any databases that you have defined are correctly registered with ODBC on your machine.

You can add a database mapping input (source) from the Resource Navigator view in two different ways, depending on whether you are adding the database to the workspace for the first time, or the database has previously been imported and is in the workspace.

  1. To add the database to the workspace for the first time:
    1. Open the relevant mapping file in the Message Flow Mapping editor.
    2. Right-click anywhere in the white space of the Source pane.
    3. Select Add RDB Table Mapping Input from the pop-up menu. The Add Database Table Schemas window appears.
    4. Select the first radio button, entitled Import and Add Table Schemas from a Database, and click Next. The Database Connection window appears.
    5. Enter the database name, user ID, password, database vendor type, JDBC driver, and the class location of db2java.zip.
    6. Click Next. The Database Table Selection window appears.
    7. Select the table that you want to use and enter the Place in Folder, if you know it, or click Browse and select it from the displayed list.
    8. Click OK and then Finish. The previously-selected table appears in the source view.
  2. To add a database that has been imported and is in the workspace:
    1. Open the relevant mapping file in the Message Flow Mapping editor.
    2. Right-click anywhere in the white space of the Source pane.
    3. Select Add RDB Table Mapping Input from the pop-up menu. The Add Database Table Schema window appears.
    4. Select the first radio button, entitled Add Database Table Schemas from Workspace, and click Next. The Select Database Table Schemas window appears.
    5. Expand the view if necessary and select the tables that you want to use in the Source view.
    6. Click Finish. The previously-selected table appears in the Source view.

If you cannot import the database definition, have your database administrator export the database schema files for you to use.

You can also import database schema files using the Data Perspective, which is available with the WebSphere Studio Application Developer Integration Edition.

By default in mappings, database table names are identified by the broker default schema and are in the format:
Database.table_name.
However, if you define a broker schema for your application and define tables within the broker schema, you must prefix the table names with the broker schema name to produce the following format:
Database.schema_name.table_name.
To do this:
  1. Right-click the database table in the source pane and select Set RDB Schema Name from the pop-up menu.
  2. Select one of the three options:
    • Use default runtime schema for this data source produces the format:
      Database.table_name.
    • Use schema name in table definition produces the format:
      Database.schema_name.table_name
      where schema name is obtained from the database table .xmi file.
    • Use name specified produces the format:
      Database.user_specified_schema_name.table_name.
  3. Click OK to save your changes.

Defining the database schema name for an individual table, as described above, overrides the global definition in the Preferences dialog (see Defining the schema name).

Note: Do not rename the .tblxmi file, or you will have to re-map everything.

Related concepts
Mappings
Mapping types
Message mapping

Related tasks
Adding a message mapping input
Adding a message mapping output
Defining the schema name

Related reference
Mappings