Anda di halaman 1dari 8

About the SQL Data Format

The SQL data format enables you to create a map directly from a database schema, which saves time
and ensures that the map is synchronized with the most current version of the database. You can also
specify several data sources so that the translator can query or update multiple databases during
translation.
The Sterling B2B Integrator Map Editor enables you to:

Specify data sources that the translator uses to query for data or update data in multiple
databases in a single translation session.

Add data sources and then test the connection and edit the connection string.

Test queries against data sources and generate result sets.

Generate fields directly from the result sets of queries.

View a model of the database schema, including lists of tables and columns.

Generate fields directly from your database schema.

Check the consistency of the map with your database.


Note: SQL functions cannot be inserted in any other type of map.

About the SQL Manager


The SQL Manager tool enables you to search the database for information to send to IBM Customer
Support, to help troubleshoot problems within the database tables. This is a tool that only the system
administrator can access, unless the system administrator provides the users permission to the SQL
Manager through the user accounts.
Note: Use this tool only when IBM Customer Support directs you to use it. You can make permanent
changes to your database, which may result in damage to your configuration and the loss of data.
Considerations for SQL Mapping

Note: If you use the SQL syntax on both sides of a map, each side must use a separate set of data
sources. One side cannot refer to the data sources belonging to the other side of the map.
For outbound processing, you need a way to determine which records in the database tables were
processed. Therefore, you must be able to mark records so that when you process the map, you can
select only the unprocessed records in the tables.
To mark records as processed or not processed, you must designate a column in your database to
contain a processing flag. This can be a process column that you insert into your database, or an
unused column. You must incorporate this column into the SQL statement record in your map. Also,
you must update this column from the map to indicate that a data record was processed.
Note: Before adding a process column to your database or changing the function of an existing
column, copy your data to separate work tables in your database. Copying your data ensures that
your testing will not overwrite existing data.

The Sterling B2B Integrator Map Editor enables you to export data directly to a database.
Note: When you copy and paste map components on the SQL side of a map, any links from the
copied SQL structure are not preserved.

How the Translator Works with SQL Maps

How the Translator Works with SQL Maps


Following are some caveats about how the translator works with SQL maps:

The translator operates in transactional mode and will roll back any database updates if the
process fails.

If the pool.Type parameter in the JDBC pool is set to local, the translator controls when the
rollback occurs. This means that any compliance errors or errors from failed
insert/update/delete statements will cause the rollback to occur.
Note: If the JDBC pool.Type parameter is set to remote, the database controls when
rollbacks are issued. For a SQL map, it is recommended that the Type parameter be set to
local.

To commit after each iteration, you must add the following line must be added to
the translator.properties file:
commit_after_map_iteration=true

If a full translation is complete or the commit_after_map_iteration property is set to true


in translator.properties, and the Use transactions property is set in the map, and if
the sql.noRollbackOnValidationError property in the translator.properties file is set to
false, then the commit occurs regardless of whether translation errors exist.

On the Input side of a map you cannot pass parameters to the query being issued. That is,
you cannot pass to the query: a value from the map, a variable, or any data that is hard-coded
by using constants or a codelist.

You cannot generate a result set on the Output side of a map because you cannot use an
Input record on the Output side of a map (and an Input record is the only map component
able to generate a result set).

At least one field (column) in an Output Record must be defined as a TableKey.

Overview: How to Create Map Objects


The map objects that you can create depend on which map object is currently selected (has focus in
the map). The following list describes the available options (N/A indicates that no map object can be
created when the specified object is selected):
If the Currently-Selected Object Is
Then You Can Create
SQL File Format

Group

Statement record

Cursor operation record (input only)

Input record (input only)

Output record

Group

Statement record

Cursor operation record (input only)

Input record (input only)

Output record

Group

Statement Record (Query/Command)


N/A
Cursor Operation Record
N/A
Input Record
Field
Output Record
Field
Field
N/A
Managing the SQL File Format
The SQL File Format object represents the SQL data sources that are being mapped, including the
root element. This object is created automatically by Sterling B2B Integrator Map Editor and enables
you to define SQL data sources, data source connection parameters, and extended rules.
Note: The SQL File Format object cannot be referenced by standard rules or links.
Sterling B2B Integrator is Java-based, and uses Java Database Connectivity (JDBC) to connect to
external databases. Sterling B2B Integrator Map Editor is Windows-based, and uses Open Database
Connectivity (ODBC) to connect to external databases. To use the JDBC adapter or Lightweight JDBC
adapter, you must set up a connection to the external database that contains the tables you want to
access.

Modify SQL File Format Properties

Create a SQL Data Source

Modify SQL File Format Properties


About this task
To modify the properties of an SQL file:

Procedure
1. Right-click the SQL File icon and select Properties from the shortcut menu. The Sterling B2B
Integrator Map Editor displays the SQL File Properties dialog box (Name tab displayed by
default).
2. Do you want to create an SQL data source?
o

If Yes, click the Data Sources tab to access data source options.

If No, continue with step 3.

3. Do you want to specify an extended rule for the SQL file?


o

If Yes, click the Loop Extended Rules tab, define the rule, and continue with step 4.
See Using Extended Rules for more information about extended rules.

If No, continue with step 4.

4. Click OK. The Sterling B2B Integrator Map Editor saves your changes and closes the SQL
File Properties dialog box.
Parent topic: Managing the SQL File Format
Create a SQL Data Source
About this task
To create a SQL data source:
Procedure
1. Right-click the SQL root element. From the shortcut menu, select Properties.
2. In the SQL File Properties dialog box, click the Data Sources tab to access the data source
options.
For more information about properties, see Sterling B2B Integrator Map Editor Properties.
3. Click SQL Data Sources.
4. If you want to select a computer data source, select the Machine Data Source tab in the SQL
Data Sources dialog box.
Note: Map Editor does not support file data sources.
5. In the Machine Data Source tab, select the computer data source you want to use and
click OK.
Sterling B2B Integrator Map Editor closes the Select Data Source dialog box and displays
a Login dialog box.
6. Verify the login information and click OK.
7. In the SQL File Properties Data Sources tab, complete the following fields:
o

DSN (required)

DATABASE (optional)

Password (optional)

User-defined name for this data source (optional)

8. Click Add.
Sterling B2B Integrator Map Editor adds the data source to the list and prompts you that it is
creating the schema for that data source if you selected the connect option.
9. Do you want to test the connection to a data source?
o

If Yes, select the data source and click Test Connection.


Map Editor attempts to rebuild the schema whenever you perform an update or check
database consistency, and it tests all queries running against that data source.
Sterling B2B Integrator Map Editor tests the connection of the selected data source
and prompts you with a dialog box containing the results of the test. Click OK to close
the dialog box.

If No, continue with the next step.

10. Click OK to close the SQL File Properties dialog box.


Managing Statement Records
The statement record represents a SQL query (which returns data and can be used later in the map)
or command. Each statement record is associated with a single data source. If the schema for that
data source already exists, the Sterling B2B Integrator Map Editor displays all the tables for your
reference.
To use a statement record, you first select a data source. If a schema was generated for the selected
data source, the Sterling B2B Integrator Map Editor displays a list containing all the tables and views.
Then, you can type a SQL statement, test its validity, and generate a result set of columns returned
from the query or stored procedure. This result set is used in the SQL field generator for input records.
Then you can connect to the data source and test it.
If you specify the name of a stored procedure instead of a SQL statement, you must select the stored
procedure option.
Note: The statement record cannot be referenced by standard rules, extended rules, or links.

Create a Statement Record

Create a Statement Record


About this task
To create a statement record:

Procedure
1. Right-click a map object and select either Create Sub or Insert from the shortcut menu.
2. From the shortcut menu, select Query/Command. The Sterling B2B Integrator Map
Editor displays the SQL Statement Record Propertiesdialog box.
3. In the Name tab, specify the following:
o

Unique statement record name

Description (if applicable)

Additional notes (if applicable)

4. Click the Sql tab to access the statement options.


5. From the Data Source list, select the data source you want to use for this statement.
6. In the SQL Statement box, type the SQL statement or stored procedure.
7. Do you want the Sterling B2B Integrator Map Editor to return a result set when you test the
statement?
o

If Yes, select the Returns a Result Set option and continue with step 8.

If No, continue with step 8.

8. Is the statement a stored procedure?


o

If Yes, select the SQL statement is Stored Procedure option and continue with the
next step.

If No, continue with the next step.

9. Click Test SQL.


Note: This function is only valid if you selected Test Connection on the SQL File Format
Properties dialog box (Data Sources tab).
See Managing the SQL File Format for more information.
The Sterling B2B Integrator Map Editor tests the statement and, if specified, returns a result
set.
10. Click OK. The Sterling B2B Integrator Map Editor saves the statement record and closes the
SQL Statement Record Properties dialog box.
Managing Cursor Operation Records
The cursor operation record contains instructions for the translator to move through the result set to a
new record. Each cursor operation record is associated with a single SQL statement record.
Note: Cursor operation records are only permitted on the input side of a map.
The Sterling B2B Integrator Map Editor performs cursor operations when the translator encounters
them as it processes the map.
Note: The cursor operation record cannot be referenced by standard rules, extended rules, or links.

Create a Cursor Operation Record

Create a Cursor Operation Record


About this task
To create a cursor operation record:
Procedure
1. Right-click a map object and select either Create Sub or Insert from the shortcut menu.
2. From the shortcut menu, select Cursor Operation. The Sterling B2B Integrator Map
Editor displays the SQL Cursor Operation Record Properties dialog box.
3. In the Name tab, specify the following:
o

Unique cursor operation record name

Description (if applicable)

Additional notes (if applicable)

4. Click the Cursor Operation tab to access the operation options.


5. From the Query Record Association list, select the query that the translator uses to obtain a
result set that is then moved to the record.
6. From the Cursor Operation list, select the cursor operation.
For more information about the cursor operations, including their definitions, see Sterling B2B
Integrator Map Editor Properties.
7. Click OK. The Sterling B2B Integrator Map Editor saves the cursor operation record and
closes the SQL Cursor Operation Record Properties dialog box.
Managing Input Records
An input record contains a logical group of fields that are appropriate to be mapped to the output
format.
For example, the input side of the map is SQL and the output file format is Positional, and you must
generate a record using information from two separate queries. You can create an SQL input record
that contains fields which obtain data from the appropriate columns of both queries. Then you can link
those fields directly to the corresponding positional fields.
Note: The input record cannot be referenced by standard rules or links.
For more information about properties, see Sterling B2B Integrator Map Editor Properties.
For more information, see:

About Key Field Matching

Auto Get Next Row Operation

About Key Field Matching

Auto Get Next Row Operation

Anda mungkin juga menyukai