In our previous tutorial, we learned how to use TIBCO Adapter Publication Service to get data from a database and make it available in our TIBCO business process. In this step by step TIBCO Adapter Subscription Service tutorial, you will learn how to use adapter subscription service to insert data in a database table.
When running as a subscriber, TIBCO adapter listens on a subject, receives messages and updates the relevant tables in its associated database. The data is then available to other applications that have access to the database.
In this tutorial, we will use adapter subscription service for inserting data from TIBCO business process into a database table TBL_EMPLOYEE_SUB. Below is complete tutorial step by step:
Step 1: Create Database Table
We will use same database schema and db connection as we used in our adapter publishing service tutorial. In the database, create a new table TBL_EMPLOYEE_SUB using below script:
— Create table
create table TBL_EMPLOYEE_SUB
(
EMP_CODE VARCHAR2(20),
EMP_NAME VARCHAR2(30) not null,
EMP_DESIGNATION VARCHAR2(30) not null,
EMP_AGE VARCHAR2(10)
)
Step 2: Configure Adapter Subscription Service
Our Adapter Configuration is already there which we did in Adapter Publisher tutorial Step 2. We only need to add a new adapter service in Adapter Services Folder by choosing Subscription Service. In the Table tab of its configuration, add the table name TBL_EMPLOYEE_SUB. Table columns will be added as shown below:
We don’t need to make any changes to other configuration tabs. We are simply done with configuration of our Adapter Subscription service. Adapter Subscriber service icon turns blue if it has no issues. If its color is Pink, click on Apply Button in the Table tab and see if it turns blue.
Step 3: Create TIBCO Process to Publish to Adapter Subscription Service
We need to create a business process from which we will Publish some data towards our TIBCO Adapter Subscription service so that it may be written to our database table. In the Processes folder of project, I have created a new process EmployeePublisher in which Publish To Adapter activity is used as shown below.
In the configuration tab of Publish to Adapter activity, choose Tibco Adapter Subscription service that we created in Step 1.
In the transport tab of this activity, no change is required in our tutorial example and we will go with the default. We can see in below snapshot that Subject is same as that of our Subscription Service, so it will publish the message to our adapter subscription service.
In the input tab of Publish to Adapter activity, we need to specify input data. We can see that in body, it asks for input values for all columns of our database table. I have specified some hard coded values here just as an example. In practical scenarios, this data should be coming from some other source in the process starter.
Step 4: Start Adapter Tester
After completing all required configuration changes of our process, we are now good to go for testing phase. First we need to start Adapter Tester by choosing Tools–>Show Adapter Tester
Step 5: Run Process in Designer Tester
In designer tester, load the process EmployeePublisher and start it.
You will see that process runs successfully and publishes data to the Adapter Subscription service as shown below:
Step 6: Verify Adapter Subscription Service Results
Now our last step of this tutorial is to verify that our adapter subscription service has inserted the data in database table TBL_EMPLOYEE_SUB.
Run following query:
select * from tbl_employee_sub
And below are query results:
So it shows that our Adapter Subscription service has successfully written data in database table.
Pingback: Tibco Database Adapter: Step By Step Tutorial | Tibco Guide
Hi,
Can anyone please let me know how to insert multiple records using adapters
Hi
You can insert multiple records by applying a group to the Publish to Adapter Activity.
Hi,
II am looking for a tutorial that explains the use of Copybook palette.
how to convert an XML file to a flat file using TIBCO BW?
how to convert a flat file to an XML file using TIBCO BW?
how to convert a CCV file to an XML file using TIBCO BW?
My flow is running correctly but i amm unable to see the input data in the table.Kindly help