Saturday, 16 August 2014

Creating the XA Data Source in weblogic for ORACLE DB

Prerequisite:
Need Oracle DB installed and should have TNS and user details.

Creation of Data Source(DS):
We are using weblogic console to create DS here.
First will create the data source and then a connection pool for that data source.

A. Data Source:
1. Open the WebLogic Server Administration Console and login using admin credentials.
e.g. http://localhost:7001/console  admin url and credentials weblogic/welcome1
2. Left hand side on navigation bar, Click Services --> Data Sources.
3. In the data source table, click New. If New button is grayed out/disabled then you should click on lock & edit on left hand side to make it enable for creating new data source.
4. Enter the data source information
 Name: soaTestDS
 JNDI Name: jdbc/soaTestDS
 Database Type: Oracle
5. Database driver defaults to the correct driver: Oracle’s Driver (Thin XA) for Instance connections:versions:9.0.1 and later so leave it as it is.
6. Click Next, click Next again.
7. Provide the following details for the data source
 Database Name: XE (your database SID)
 Host name: localhost (host where your database is running)
 Port: 1521 (set according to your configuration)
 Database user name: soademo (created in previous section)
 Database user password: soademo
8. Click Next
9. Click on Test Configuration just to make sure all the details are valid and we are able to connect to respective DB. If test fails check the DB details you have configured for the data source.
10. Click Next.
11. Target it to the cluster/managed server/admin server depending on your setup.
12. Click on Finish.

B. Connection Pool:
1. Click on Deployments form the left navigation bar.
2. Click the DbAdapter application name.
3. Click the Configuration tab, and then click the Outbound Connection Pools tab.
4. Click New.
5. Select the radio button for javax.resource.cci.ConnectionFactory and click Next.
6. Enter the JNDI Name as follows: eis/DB/soaTestDS.
7. Click Finish.
8. Now, need to edit the connection pool to reference the data source which we have created. Click the Configuration tab, expand the connection factory and click your new connection pool name: eis/DB/soaTestDS.
9. In the Properties table, view the box to the far right of xADataSourceName and specify value: jdbc/soaTestDS. Hit enter button once the value has been provided.
Note: You need to hit Enter to save the value. only save click won't work.
10. Click on save.
11. Now need to update DB adapter application and plan.xml to reflect new changes.
12. Click Deployments in the left navigation bar.
13. Select the DbAdapter checkbox.
14. Click on Update to update application.
15. Select Redeploy this application and confirm the deployment plan location.
16. Click Finish. If you are having multiple hosts for the managed servers then copy plan.xml manually to the respective host on the same location as admin otherwise you might face an data source issue during runtime.

Verification:
To confirm that the connection pool is added we just need to go back to the Deployments --> DbAdapter --> Configuration --> Outbound Connection Pools.
You should have eis/DB/soaTestDS listed there. Click on it to verify it's configuration.

So simple isn't it?

No comments:

Post a Comment