Wednesday, 24 August 2016

Using Database Adapter SOA 12C

Database Adapter 




We are starting one of most important topic of SOA, database adapter. Its very unlikely that a project in fusion middleware have not used, database adapter.

In SOA we know everything is presented a webservice. Hence to create a process if we need to do some interaction with database then we have two options

1. Create a webservice in any technology  and then expose it.

2. Directly interact with database using the database adapter.


As the name suggest this adapter provide an interface between the database and present it our process in webservice form.  Once this adapter created then there is almost no difference calling a werservice from the BPEL process or calling a database adapter.

  But there are some steps involve in weblogic also. We are breaking this post into two steps

1. Creating a create, insert, delete operations. (Post 1)

2. Weblogic configurations  (Post 1)

3. Calling a plsql procedure from database adapter  (Post 2)

4. Calling a plsql procedure with types from database adapter   (post 2)


In this post we will create a employee and then will update the employee and read it.


1. First create a schema, which have following attributes

  a. emloyeeName
  b. userName
  c.  firstName
  d.  LastName

 or take schema from the project link, given below.
   



2. Once done create a new application and project, and add the new schema, can copy the employeeSchema from the project added in this blog.




3. Now create a new BPEL and choose request and response schema, from the xsd which is been copied from the project.




4, Now create a new connection and give the credentials according to your database.








5.  Now create a new database adapter and name it employee schema.


b) Now choose the db connection which we created earlier.


c) Now choose all the options which you want this db adapter to perform.


d) Now choose table, in this example, we are using employee schema.





g) In this i have created an employeeId parameter to select the employeeId for select.


See the images given below.



6) Now we can call this db adapter as a simple service.  Use xlst or assignment to assign the values to the service (db adapter).




7. Now we are ready to start for the testing of our object. Deploy and provide the inputs.



Weblogic Configurations. 

    Database Connection Creation 
    1. Create a new connection in the web-logic server use the below screenshots for more clarity.


2. Now have the connection, almost same as given below. JNDI name should jdbc/HRDB


3. Now add the information about the host and also the username and also password.


4. Now test the connection and add the target as the Default server.







    DB Adapter Connection Creation 

      1. Now go the weblogic console again and click on deployments, now you can see database adapter as of the application.  To use any connection our connection should be available under database adapter.

     
   

  2. Once DB adapter application open click on configuration and then select outbound connection pools. Once here click on new. 


3.Now provide the JNDI name as eis/db/HRDB.  This jndi should be the same name, which was used in the database adapter. Actually this connection database adapter will search in the application and this connection pool will allow connection to the actual database.


4. Now enter XADataSource name, as we want adapter to execute and should not take part in the actual transaction.  Once done save.



5. Now update the database adapter, select the database adapter and the update.

6. Now it will show the deployment plan and then finish. In SOA 12c, we can use it post deployment.  In older version we need to first restart before using it.






Running part 1.


   Now deploy the application and once deployed you can provide the payload stored with the application.


Once its done click on launch the flow trace and you can see the below level of flow trace.



Database Running.

 Now check the database, this row is already there.


 


Download 


 Please use the link to download the exercise.



Exercise 

1.  Add an operations to delete the employees.

2.  Add an BPEL to merge the employees.


Let us know your feedback. We are continues with next post for the Plsql procedure.




  
















No comments:

Post a Comment