Database Adapter

Preview:

Citation preview

Articl

esQuestions | Subscribe |

Testimonials

Login | Signup

     

HOME

ARTICLES

INTERVIEW QN'S

SCRIPTS

ABOUT

CONTACT

CONNECT

User Questions  |  R12 User Guides  |  11i User Guides  |  11i Vision Instance  |  R12 Vision Instance  |  Post Article  |  Request Mock Interview  | 

BPEL Database Adapter Part 1Author

Name: prudhvi E-mail: prudhvi@erpschools.com

 

 

Database Adapter is a partnerlink in BPEL which is used to interact with

Database for read, write operations. Using Database Adapter we can perform

the following functions.

1. Call a Stored Procedure of Function

2. Perform DML operations like insert, update, delete on a table

3. Perform SELECT operation

4. Execute custom SQL Statements

/w EPDw ULLTEw MDUyNjYzMjgPZBYCZg9kFgQCAQ9kFgQCAQ8WAh4HY29udGVudAUrRGF0YWJhc2UsQWRhcHRlciw gQlBFTCxyZWFkLCB3cml0ZSw gZXhhbXBsZWQCAg8WAh8ABfQDRGF0YWJhc2UgQWRhcHRlciBpcyBhIHBhcnRuZXJsaW5rIGluIEJQRUw gd2hpY2ggaXMgdXNlZCB0byBpbnRlcmFjdCB3aXRoIERhdGFiYXNlIGZvciByZWFkLCB3cml0ZSBvcGVyYXRpb25zLiBVc2luZyBEYXRhYmFzZSBBZGFw dGVyIHdlIGNhbiBw ZXJmb3JtIHRoZSBmb2xsb3dpbmcgZnVuY3Rpb25zLg0KDQoxLiBDYWxsIGEgU3RvcmVkIFByb2NlZHVyZSBvZiBGdW5jdGlvbiANCjIuIFBlcmZvcm0gRE1MIG9w ZXJhdGlvbnMgbGlrZSBpbnNlcnQsIHVw ZGF0ZSw gZGVsZXRlIG9uIGEgdGFibGUgDQozLiBQZXJmb3JtIFNFTEVDVCBvcGVyYXRpb24gDQo0LiBFeGVjdXRlIGN1c3RvbSBTUUw gU3RhdGVtZW50cyANCg0KSW4gdGhpcyBBcnRpY2xlIEkgd2lsbCBleHBsYWluIGhvdyB0byBjcmVhdGUgc2ltcGxlIHN5bmNocm9ub3VzIEJQRUw gcHJvY2VzcyBjb250YWluaW5nIERhdGFiYXNlIEFkYXB0ZXIgd2hpY2ggd2lsbCByZWFkIHRoZSBkYXRhIGZyb20gYSB0YWJsZSBhbmQgcGFkAgMPZBYIAgEPZBYQZg8WAh4EaHJlZgUTcnNzL2FydGljbGVzcnNzLnhtbGQCAg8WAh8BBRRyc3MvcXVlc3Rpb25zcnNzLnhtbGQCBA8QZGQWAWZkAhoPDxYCHgdWaXNpYmxlaGRkAh4PDxYCHw JoZGQCQA8WAh8CaGQCQg8PFgIfAmhkZAJ6DxYCHgRUZXh0BZcFPHNjcmlw dCBzcmM9Ii9BcHBz

0 0 vpIxaUJoP15gmci1c5zq1CU-vNdLrWw OFkLCyZn3eOYyvSXU7A39KukjsMUcnzc6UFUi5NlMlU4bxrkQdYg2RuZnOGJQTlNZ6WTE-5rmAY-SYKfqBC7kK5KtCDtCs0KOLCAyQLkIkhk9s3z6vBheO6dr7FN3VJdYdUE0X0zZSIyA_TVl7NFdaZQ99XLvOUKht1RH0w 2/w EWHAKx/J+vBQK9+6DsDQKGlJKDAQL1lOaDAQKGlP6DAQKClMKDAQKHlMKDAQL+lP6DAQKShq+0Aw Lmj7rpBQKipcbvDAK3z/01Aq7riLAGArLA5pkLAomw vvYNAomw 0tEGAomw 5qw PAomw +ocIAomw jmMCibCivgkCibC2mQICw 97q6AICj4K52w UC/tjalw sCruvukw gCxtey1w 0CydWCtgoC24+BqgFNVf3q45iiEyw TWLe8Nw uQ/PGzFw ==

English

008847959432230710149:f24qrsxseto

FORID:10

In this Article I will explain how to create simple synchronous BPEL process

containing Database Adapter which will read the data from a table and pa

Overview:

Database Adapter is a partnerlink in BPEL which is used to interact with Database for

read, write operations. Using Database Adapter we can perform the following functions.

1.      Call a Stored Procedure of Function

2.      Perform DML operations like insert, update, delete on a table

3.      Perform SELECT operation

4.      Execute custom SQL Statements

In this Article I will explain how to create simple synchronous BPEL process containing

Database Adapter which will read the data from a table and pass the value to output

parameter.

Prerequisites:

1.      You need to establish a Database Connection in Connection Navigator before you proceed further. Refer to my previous article on how to create a Database Connection by

clicking the following link h t t p : / / w w w . a p p s f a q . c o m / A p p s / o r a c l e - a p p l i c a t i o n s / a r t i c l e s / F u s i o n - M i d d l e w a r e / S O A / B P E L / B P E L - O l i t e - D a t a b a s e - C o n n e c t i o n / i n d e x . a s p x

2.      If this is your first BPEL Process I suggest you to go through my hello world article first.

h t t p : / / w w w . a p p s f a q . c o m / A p p s / o r a c l e - a p p l i c a t i o n s / a r t i c l e s / F u s i o n - M i d d l e w a r e / S O A / B P E L / B P E L - T u t o r i a l - f o r - b e g i n n e r s - w i t h - h e l l o w o r l d - e x a m p l e / i n d e x . a s p x

Create Application:

Open JDeveloper and select Applications in the JDeveloper

Right Click on ‘Application’ and select ‘New Application’

Create Application Window opens as show below

Change the Application Name to ‘DatabaseAdapterTutorial’

Leave remaining fields with default values and click OK

 

Click Cancel not the OK button

Create Process

Right click on the DatabaseAdapterTutorial and click New Project as show below

Select ‘BPEL Process Project’  from the projects list

Click Ok

Chang the Name which is optional and change the Template to Synchronous BPEL

Process as shown below.

Click Next

Leave the default values and click Finish

DatabaseAdapterTutorial Shows up in the Applications Navigator

On the right side of the jdeveloper window select ‘Services’ in the component Palette

dropdown box.

 

Select the Database Adapter and Drag it to right side Services portion of jdeveloper main

window

Adapter Configuration Wizard screen will pop up as below

Click Next

Enter the Service Name as ‘FetchEmail’

Description field is optional

Click Next

Select the Database Connection ‘BPELOlite’ from the Connection list. This connection

varies as you create Database connections in Connection Navigator

Leave the JNDI Name with default value and click next

Select ‘Perform an Operation on a Table’ option from the list

check Only ‘SELECT’ checkbox

Click Next

Click on Import Tables button

Click on the Query button to see the list of tables available in your database

Select the Table name from the list on which you want to operate the select command

I have selected the table ERPSCHOOLS. I am listing the commands below to create the

table ERPSCHOOLS if you want to use

Now Click Ok

Click Next

Select all columns and click Next

I am not creating any relationship with this table so just click Next button

Click Next

SELECT command is shown in SQL box.  If you want to add any parameters to the query

you can add it here. You can also directly edit your SQL statement. I am changing my

SQL statement to fetch only one record.

Click Next

Click Finish

Create Partner link will pop up as shown below

Leave all fields with default values and click OK

Now your BPEL main window screen should look like the below screen

Fetch email partner link/Database Adapter will show in Service area as shown in the red

circle.

Now select ‘Process Activities’ in the Component Palette

Select and Drag the Invoke activity below the receiveInput activity

Double click the Invoke_1 activity

Change the Name to Invoke_FetchEmail

Click on the Flashlight right to Partner Link Field

Select FetchEmail and click OK

Partner Link and Operation fields are populated automatically

Click on the Create Variable fields right to both input and output Variables

Click the small red circle icon, create variable window will pop up as shown below

Click Ok

Now click on red circle icon right to output variable

Click Ok

Click Apply

If you have everything correctly you should not see the errors in the red circle show in the

above figure.

If you don’t have any errors click OK

Main screen should look like the above picture.

We have created the Invoke activity which will call Database Adapter(FetchEmail) and

Database Adapter will query the table ERPSCHOOLS and fetches email field value. Now

to catch the value fetched by Database Adapter use Assign Activity, which will transfer

the value of email field fetched by Database Adapter to replyOutput field.

Drag the Assign activity from the component palette to mainwindow below the

Invoke_FetchEmail activity.

Double click on Assign_1 activity to open the Assign properties window

Chang the name to Assign_Email and click on the second tab ‘Copy Operation’

Click Create button circled above and select ‘Copy Operation’ to open the Create Copy

Operation window as show below

Select ns2:email on the left and client:result on the right side as show below

Click OK

Click Apply to remove the errors

Click Ok

Save your project by clicking CTRL+S

DEPLOY BPEL Process

Now we are ready to deploy the process, Start your SOA Suite and deploy the process

If you are not familiar with deploy process follow the link to see how to deploy the process

After you deploy your process successfully your Apache Ant log will show like this

Run the BPEL Process

Go to your BPEL Console

h t t p : / / l o c a l h o s t : 8 8 8 8 / B P E L C o n s o l e

login in with oc4jadmin/welcome1 (default values)

Once you login to console you can see ‘DatabaseAdapterTutorial’ project in the Deployed

BPEL Processes list.

Click on DatabaseAdapterTutorial

The initiate screen will show up

Click on Post XML Message

Click on Visual Flow

Click on Assign_Email activity to see the output

The result field contains p r u d h v i @ e r p s c h o o l s . c o m which is my output.

praneeth commented on 11/19/2009 12:30:50 AM

Excellent tutorials for Bpel beginners. Thanks for providing this to us Prudhvi.

   

Hemadri commented on 11/25/2009 3:59:34 AM

Good article

   

Brindha commented on 12/2/2009 3:59:24 AM

Really Good.. Understood the concept of DB adapter now!!

   

saravanan commented on 12/22/2009 2:48:01 AM

v.good article .would requesting to post more article on the same area if u have time.

   

Jay

Shete commented on 1/1/2010 5:32:28 PM

Very good example, Thanks for your help

   

Pawan

Saini commented on 3/10/2010 9:24:31 AM

Nice article. I have a question here, If I do not put any where clause in the generated

query will it return the complete data in the table?

   

Bhushan commented on 3/25/2010 4:46:42 PM

Hi, how can I import multiple table?

   

venky commented on 5/18/2010 3:44:22 AM

In the database connection, i connect to a remote Oracle database, when i deploy and

run the process,it gives an exception saying "Could not create/access the TopLink

Session.

This session is used to connect to the datastore" and says to change the oc4j-ra.xml in

the J2EEHome directory....pls help

   

stanly commented on 5/29/2010 11:03:11 AM

Nice tutorial Prudhvi. Thanks for sharing it with us.

    1

Comments Box

Name:

Email:

Receive email on comment updated

    Copyright © 2007 www.erpschools.com

In this article I will explain how to pass parameters to the Database Adapter. This article is

continuation of our previous Database Adapter Tutorial 1.

Open previously created project in jdeveloper.

Post

Cancel

Now Double Click the ‘FetchEmail’ Database Adapter

Click the Define Adapter Service Icon

Click Next

Next

Next

Next

Next

Next

In the Parameters Section Click Add Button

Enter Parameter Name as v_id

Click Ok

In the SQL Section click Edit Button

Click Yes

Click Add

In the Second Argument select Parameter option and select v_id

Click Ok

Click Next

Click Finish

Click Apply and Ok

Save Project CTRL+S

Now Double Click Invoke_FetchEmail activity and

Select Operation as FetchEmailSelect_v_id

Click Automatically Create Input Variable button and Automatically Create Output Variable

buttons to create new variables

Click Apply and then OK

Save Project CTRL+S

Drag Assign Activity below the receiveInput and above the Invoke_FetchEmail

Double Click Assign_1 activity

Click Copy Operation tab

From Type: Variable

Client:input

To Type: Variable

ns2:v_id

Click Ok

 

Click Apply and OK

Save project CTRL+S

Double Click Assign_Email

And change the Copy Operation as per below picture

Click Ok

Save CTRL+S

Deploy the process

Select version as 1.1

Click Ok

BUILD SUCCESSFUL

Now go to h t t p : / / l o c a l h o s t : 8 8 8 8

Click BPEL Control

Click On DatabaseAdapterTutorial v 1.1

Enter the ID number as input and click submit

Output is displayed

Verify the output with Database

Pratap commented on 9/22/2009 5:24:35 PM

Hi,

Thanks for sharing the info.

How to fetch multiple records using db adapter.

Right now I have 5 to 6 columns in my query and in the output of bpel process I can view

only one column.

How can I view multiple columns and multiple records.

Thanks in Advance

Pratap

Regards,

Pratap.    

mIKE commented on 10/15/2009 12:39:37 PM

do you have an update example??    

vinodkumar commented on 8/17/2010 3:23:50 AM

HI SIR,

THANKS FOR GIVING ME THIS VALUEABLE INFORMATION..........    

Recommended