0% found this document useful (0 votes)
61 views9 pages

Database Mapping in Sterling Integrator

The document outlines the steps to create a Database Adapter, set up a JDBC Pool, and create an SQL Mapping in Sterling B2B Integrator. It provides detailed instructions for configuring the database connection, writing SQL queries, and integrating them into a BPML process for fetching order details. Additionally, it includes troubleshooting tips for common issues encountered during setup and execution.

Uploaded by

BimalKumarBarik
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
61 views9 pages

Database Mapping in Sterling Integrator

The document outlines the steps to create a Database Adapter, set up a JDBC Pool, and create an SQL Mapping in Sterling B2B Integrator. It provides detailed instructions for configuring the database connection, writing SQL queries, and integrating them into a BPML process for fetching order details. Additionally, it includes troubleshooting tips for common issues encountered during setup and execution.

Uploaded by

BimalKumarBarik
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 9

1.

Create the Database Adapter

Go to: Deployment > Adapters > Database Adapter

 Click Create New Adapter.

 Provide a Name for the adapter.

 Choose the appropriate Database Type (like Oracle, SQL Server,


MySQL, etc.).

 Enter the JDBC URL (like jdbc:mysql://host:port/database).

 Add Driver Class (like com.mysql.cj.jdbc.Driver for MySQL).

 Enter Username and Password for the database.

 Test the connection and Save the adapter.

2. Set Up the JDBC Pool

Go to: Deployment > JDBC Pools

 Click Create New JDBC Pool.

 Provide a Name for the pool.

 Choose the Database Adapter you just created.

 Configure pool settings:

o Minimum Connections

o Maximum Connections

o Timeout Settings

 Save the pool.

3. Create the SQL Mapping

Go to: Business Processes > SQL Map Editor

 Click Create New SQL Map.

 Choose the JDBC Pool you created.

 Write your SQL Query (like SELECT * FROM Orders WHERE OrderID
= ?).

 Define Input Parameters and Output Fields based on the query.

 Test the SQL map and Save it.

4. Use the SQL Map in a BPML

In your BPML:
<sql>

<jdbcPool>YOUR_JDBC_POOL_NAME</jdbcPool>

<sqlStatement>SELECT * FROM Orders WHERE OrderID =


?</sqlStatement>

<param>12345</param>

</sql>

Sample Example :

Table structure:

OrderI CustomerNa OrderDa Amou


D me te nt

2025-02-
1001 John Doe 500.00
20

2025-02-
1002 Jane Smith 750.00
22

Step 1: Create the Database Adapter

1. Go to Deployment > Adapters > Database Adapter.

2. Click Create New Adapter.

3. Fill out the following details:

o Name: MySQL_OrderDB_Adapter

o Database Type: MySQL

o JDBC URL: jdbc:mysql://localhost:3306/OrderDB

o Driver Class: com.mysql.cj.jdbc.Driver

o Username: db_user

o Password: db_password

4. Click Test Connection — make sure it’s successful.

5. Click Save.

Step 2: Create a JDBC Pool

1. Go to Deployment > JDBC Pools.


2. Click Create New JDBC Pool.

3. Fill out:

o Name: OrderDB_Pool

o Database Adapter: MySQL_OrderDB_Adapter

o Minimum Connections: 1

o Maximum Connections: 5

o Connection Timeout: 30000 ms

4. Click Save.

Step 3: Create the SQL Map

1. Go to Business Processes > SQL Map Editor.

2. Click Create New SQL Map.

3. Fill out:

o SQL Map Name: GetOrderDetails

o JDBC Pool: OrderDB_Pool

4. Write the SQL Query:

SELECT OrderID, CustomerName, OrderDate, Amount

FROM Orders

WHERE OrderID = ?

5. Define Input Parameters:

o OrderID → Integer

6. Define Output Fields:

o OrderID → Integer

o CustomerName → String

o OrderDate → Date

o Amount → Decimal

7. Click Save.

Step 4: Use the SQL Map in BPML

Let’s call this SQL map in a BPML process:


<process name="FetchOrderDetails">

<sql>

<jdbcPool>OrderDB_Pool</jdbcPool>

<sqlStatement>SELECT OrderID, CustomerName, OrderDate, Amount


FROM Orders WHERE OrderID = ?</sqlStatement>

<param>1001</param>

<results>

<result name="OrderID"/>

<result name="CustomerName"/>

<result name="OrderDate"/>

<result name="Amount"/>

</results>

</sql>

<assign to="OrderInfo">

Order: %OrderID%, Customer: %CustomerName%, Date: %OrderDate%,


Amount: %Amount%

</assign>

<log>Order Info: %OrderInfo%</log>

</process>

Expected Log Output:

Order Info: Order: 1001, Customer: John Doe, Date: 2025-02-20, Amount:
500.00
You can explore more depth 

Great! Let's break it down further step by step, ensuring every aspect is
covered in detail.

Step 1: Setting Up the Database Connection

Before configuring Sterling B2B Integrator (SBI), ensure that you have:

1. A running database (MySQL, Oracle, SQL Server, etc.).

2. A valid JDBC driver installed in SBI.

For this example, we’ll use MySQL.

1.1 Verify JDBC Driver Installation

 Go to Deployment > JDBC Drivers

 Check if MySQL JDBC Driver (com.mysql.cj.jdbc.Driver) is


installed.

 If not, download it from MySQL Connector/J and place the .jar file in
SBI’s lib folder.

 Restart Sterling B2B Integrator.

Step 2: Creating a Database Adapter

A Database Adapter enables SBI to communicate with an external


database.

2.1 Configure the Database Adapter

1. Go to Deployment > Adapters > Database Adapter.

2. Click Create New Adapter.

3. Fill in the details:

o Adapter Name: MySQL_OrderDB_Adapter

o Database Type: MySQL

o JDBC URL:

o jdbc:mysql://localhost:3306/OrderDB

o Driver Class:

o com.mysql.cj.jdbc.Driver
o Username: db_user

o Password: db_password

4. Click Test Connection and ensure it is successful.

5. Click Save.

Step 3: Creating a JDBC Connection Pool

A JDBC connection pool manages connections to the database.

3.1 Configure JDBC Pool

1. Go to Deployment > JDBC Pools.

2. Click Create New JDBC Pool.

3. Fill in the details:

o JDBC Pool Name: OrderDB_Pool

o Database Adapter: MySQL_OrderDB_Adapter

o Minimum Connections: 1

o Maximum Connections: 5

o Connection Timeout: 30000 ms

4. Click Save.

Step 4: Creating a SQL Map

A SQL Map allows SBI to interact with the database using SQL queries.

4.1 Define the SQL Query

We want to fetch order details from a table Orders.

SELECT OrderID, CustomerName, OrderDate, Amount

FROM Orders

WHERE OrderID = ?

4.2 Configure the SQL Map

1. Navigate to Business Processes > SQL Map Editor.

2. Click Create New SQL Map.

3. Fill in the details:


o SQL Map Name: GetOrderDetails

o JDBC Pool: OrderDB_Pool

4. Add Input Parameter:

o OrderID (Integer) → This is the dynamic input.

5. Add Output Fields:

o OrderID (Integer)

o CustomerName (String)

o OrderDate (Date)

o Amount (Decimal)

6. Click Save.

Step 5: Using SQL Map in a BPML Process

Now, we create a BPML process that queries the database using our SQL
Map.

<process name="FetchOrderDetails">

<sql>

<jdbcPool>OrderDB_Pool</jdbcPool>

<sqlStatement>SELECT OrderID, CustomerName, OrderDate, Amount


FROM Orders WHERE OrderID = ?</sqlStatement>

<param>1001</param>

<results>

<result name="OrderID"/>

<result name="CustomerName"/>

<result name="OrderDate"/>

<result name="Amount"/>

</results>

</sql>

<assign to="OrderInfo">
Order: %OrderID%, Customer: %CustomerName%, Date: %OrderDate%,
Amount: %Amount%

</assign>

<log>Order Info: %OrderInfo%</log>

</process>

Step 6: Deploy and Execute the BPML

1. Go to Business Processes > Manager.

2. Click Create Business Process.

3. Paste the BPML code above.

4. Click Save and Execute.

Expected Log Output

Order Info: Order: 1001, Customer: John Doe, Date: 2025-02-20, Amount:
500.00

Step 7: Error Handling & Debugging

If the process fails, check:

1. Database Connection

o Verify JDBC adapter settings.

o Ensure database credentials are correct.

2. JDBC Driver Issues

o Ensure the correct JDBC driver .jar is installed.

3. SQL Syntax Errors

o Run the SQL query manually in MySQL to validate.

4. BPML Execution Logs

o Go to Business Process > Monitor > Logs and check for


errors.

This setup ensures that Sterling B2B Integrator can successfully fetch
data from the Orders table and use it in an integration process.

You might also like