Requirement: Create a JDBC generic data sources in Oracle WebLogic Server.
Information: In WebLogic Server, we configure database connectivity by adding JDBC data sources to our WebLogic domain. A data source is a J2EE standard method of configuring connectivity to a database. Each WebLogic data source contains a pool of database connections. Applications look up the data source on the JNDI tree or in the local application context and then reserve a database connection with the getConnection method. Data sources and their connection pools provide connection management processes that help keep our system running efficiently.
Solution: We will use the COUNTRIES table of Oracle database XE present in the HR schema. For solution of the above requirement follow the below steps:
Step 1: Create an Oracle ADF Fusion Web Application.
Step 2: Create an ADF Business Components from tables. The ADF Business Components should contain: AppModule, CountriesEO, and CountriesVO as shown below:
Step 3: Create a demo.jsf page in the ViewController project of our application. Go to Data Control Window > ExpandAppModuledataControl > Drag and drop the CountriesVO1 collection from the Data Control to the demo.jsf page as a table as shown below:
Select the default properties in the Create table popup while creating the table as shown below and click OK.
Step 4: Start Server Instance (IntegratedWeblogicServer). To start go to Run > Click Start Server Instance (IntegratedWeblogicServer).
Step 5: Once the Server Instance starts (running) open any browser and type
http://localhost:7101/console.
Thus, it loads the log in screen of the Oracle Weblogic Server as shown below:
Step 6: Give the Username and Password to login. Thus, on successful login we will get the below page.
Step 7: Click on Data Sources of the above image of Step 6. The area is highlighted in red color. Thus, we will get the below screen:
Step 8: Click on New > Select Generic Data Source. Thus, we will get the below screen:
Step 9: Give the Name as HR and JNDI name as jdbc/HR and click Next as shown below:
Step 10: Select the Database Driver as “Oracle’s Driver (Thin) for Application Continuity; Versions:Any” and click Next as shown below:
Step 11: Again, click Next. Give the Database Name, Host Name, Port, Database Username, Password, and Confirm Password as shown below. Then click Next. Click Test Configuration. Click Next.
Step 12: Check the Servers as Default Server as shown below.
Step 13: Click Finish.
Step 14: Now go to the application and open AppModule. Click Configurations. Edit AppModuleLocal and AppModuleShared. Set the Datasource Name as jdbc/HR for both AppModuleLocal and AppModuleShared as shown below:
Step 15: Go to Application Resources. Expand Connections > Database > Delete HR connection as shown below.
Step 16: Save and run the application.
Hence, the solution to our requirement.
If you like the post please comment, share, and do join me on Facebook. Please subscribe to my YouTube Channel for video tutorials.
Thanks & Regards,
Susanto Paul
550 total views, 3 views today
[…] in Oracle WebLogic Server for the HR Schema of the Oracle Database XE as described in the post Create a JDBC Generic Data Source in Oracle WebLogic Server. Details about the JDBC Generic Data Source is given […]