Practices for Lesson 6 Practices Overview
Practice 6-1: Configure the Run-Time Database Adapter Overview
In this practice you configure the run-time server resources required for a composite application that uses a Database Adapter to store purchase order information in the SOADEMO database schema ORDER and ITEMS tables. In this practice your tasks are to:
• Create the SOADEMO database schema in the Oracle XE Database instance, and populate the SOADEMO schema with tables and sample data with supplied SQL scripts.
• Configure the appropriate JDBC resource required by the application.
• Configure the DbAdapter component with a connection factory that uses the appropriate JDBC resource.
Assumptions
The SQL scripts needed to create the SOADEMO schema and the database tables, and populate the tables are in the D:\labs\sql folder.
Tasks
In this section you perform the three tasks described in the overview of this practice.
Creating the SOADEMO Database Schema
To create the SOADEMO database schema, perform the following steps:
1. On the Windows Desktop, click Start > Programs > Oracle Database 10g Express Edition >
Run SQL Command Line.
Note: Alternatively, start a Command Prompt window and enter the following command:
D:/> sqlplus /nolog
2. In the SQL Command Line command window, enter the following commands to login as the database administrator and create the SOADEMO schema:
SQL> connect sys/oracle as sysdba Connected.
SQL> @D:\labs\sql\soademo_user.sql Grant succeeded.
SQL>
Note: Do not exit from the SQL Command Line application.
3. In the SQL Command Line command window, execute the following commands to connect as the SOADEMO user, create and populate the database tables:
SQL> connect soademo/soademo
Oracle University and (Oracle Corporation) use only.
Commit complete.
SQL>
Note: If you encounter errors when executing the above scripts, you can view the messages in their soademo_create.log and soademo_data.log files, respectively. The log files are created in the
D:\oraclexe\app\oracle\product\10.2.0\server\bin folder.
4. Minimize SQL Command Line window, because you use the application to execute additional SQL scripts that query the ORDER and ITEMS database tables after deploying and executing a database enabled composite application.
Configure the Run-Time JDBC Resource
You configure the JDBC resources by using the Oracle WebLogic 11g Administration Server Console.
5. To login to the Oracle WebLogic 11g Administration Server Console, perform the following steps:
a. On a Web Browser window enter the URL http://localhost:7001/console.
b. On the Oracle WebLogic Server 11g Administration Console Login page, enter weblogic for the user name, and welcome1 for the password, and click Login.
6. To create the JDBC resource, perform the following steps:
a. On the Oracle WebLogic Server 11g Administration Console home page, in the Domain Structure section expand the Services > JDBC tree, and click Data Sources.
b. On the “Summary of JDBC Data Sources” page, click New.
Oracle University and (Oracle Corporation) use only.
c. On the “Create New JDBC Data Source” > JDBC Data Source Properties page, enter the following case-sensitive information and click Next.
− Name: soademoDS
− JNDI Name: jdbc/soademo
Note: Accept default values for other settings.
d. On the “Create a New JDBC Data Source” > JDBC Data Source Properties page, accept the default settings and click Next.
e. On the “Create a New JDBC Data Source” > Transaction Options page, click Next.
f. On the “Create a New JDBC Data Source” > Connection Properties page, enter the following field values and click Next.
− Database Name: XE
Oracle University and (Oracle Corporation) use only.
g. On the “Create a New JDBC Data Source” > Test Database Connection page, click Test Configuration.
h. On the “Create a New JDBC Data Source” > Test Database Connection page, confirm that you get a “Connection test succeeded.” response message in the Messages section, click Next.
.
Note: If you got a connection error, then please correct the connection details before you proceed with remaining steps of this practice.
i. On the “Create a New JDBC Data Source” > Select Targets page, select the check box for the soa_server1 row in the Servers table, and click Finish.
Oracle University and (Oracle Corporation) use only.
j. On the “Summary of JDBC Data Sources” page, confirm the new JDBC resource has been created. For example:
Configure the Run-Time DbAdapter Connection Factory Resource
While logged into the Oracle WebLogic Server 11g Administration Console, you create the connection factory that associates a JNDI name used by the application with the JDBC resource configured in the section subtitled “Configure the Run-Time JDBC Resource”.
7. To configure the DBAdapter connection factory, perform these steps:
Oracle University and (Oracle Corporation) use only.
b. In the “Summary of Deployments” > Control tab page, locate the DbAdapter entry in the Deployments table and click the DbAdapter link.
c. On the “Settings for DbAdapter” page, click the Configuration tab.
d. On the “Settings for DbAdapter” > Configuration tab page, click the Outbound Connection Pools tab.
e. On the Outbound Connection Pools tab page, click New.
Oracle University and (Oracle Corporation) use only.
f. On the “Create a New Outbound Connection” page, select the javax.resources.cci.ConnectionFactory option, and click Next.
g. On the “Create a New Outbound Connection” page, enter the following JNDI Name:
eis/DB/soademo and you must also press Enter, and then click Finish.
Oracle University and (Oracle Corporation) use only.
i. On the “Settings for DbAdapter” > Configuration > Outbound Connection Pools page, (the Connection Pools tab should already be selected, otherwise click the Connection Pools tab), expand the javax.resource.cci.ConnectionFactory entry, and click the eis/DB/soademo link.
j. On the “Settings for javax.resource.cci.ConnectionFactory” > Properties tab page, for the Outbound Connection Properties table, click in xaDataSourceName row’s Property Value, type jdbc/soademo and press Enter. Then click Save.
Oracle University and (Oracle Corporation) use only.
k. On the “Settings for javax.resource.cci.ConnectionFactory” > Properties tab page, confirm the Messages at the top of the page indicate the changes have been activated and successfully updated. For example:
8. To ensure that the outbound connection properties in the new deployment plan are activated, you update the DbAdapter with a new deployment plan by performing the following steps:
Oracle University and (Oracle Corporation) use only.
c. On the Update Application Assistant “Locate new deployment files” page, select the
“Redeploy this application using the following deployment files:” option, accept the default settings for the “Source path” and “Deployment plan path”, and click Finish.
d. On the top of the “Summary of Deployments” page, in the Messages section, confirm the changes have been activated and deployments have been updated. For example: