3.2.4 Set up JDBC Data Sources
The application connects to the Oracle database through a Data Source that need to be specified in the WLS Server.
For security reasons, the database connections used by the application connect to database schemas that do not own database objects. These schemas are only granted the required privileges to use the objects.
The following sections describe setting up data sources for connecting to:
- an Oracle database that is running on a single machine
- a RAC-enabled Oracle database that is running on multiple machines
3.2.4.1 Data Source for connecting to an Oracle database that is running on a single machine
The following table lists details for the Data Source that must be configured in WLS before installing the application for use with an Oracle database that is executed on a single machine (not clustered):
Data Source Parameters |
Non-clustered database |
Explanation |
---|---|---|
Data Source Type |
Generic Data Source |
|
Data Source Name |
ohi-application-datasource |
Logical name |
JNDI Name |
jdbc/vbpUserOhiApplicationDS |
Used by the application to resolve the Data Source |
Database Type |
Oracle |
|
Database Driver |
Oracle's Driver (Thin) for Instance connections; Versions:9.0.1,9.2.0,10,11 or Oracle's Driver (Thin) for Service connections; Versions:9.0.1,9.2.0,10,11 |
|
Database Name |
SID or service name of the database If the name of the Oracle driver that was selected contains the words "for Instance connections" enter the SID. If the name of the Oracle driver contains the words "for Service connections" enter the service name. |
|
Host Name |
Name or IP address of the machine where the database is running |
|
Port |
Port on which the database is running |
|
Database User Name |
ohi_vbp_user |
Fixed value, do not change |
Password & Confirm Password |
Password of "ohi_vbp_user" |
The schema password as selected during the installation |
Service Name |
Service name of the database |
SID or service name |
The data sources can be created by either
- using the <OHI_ROOT>/util/wlst/createOHIDomain.sh script (i.e. the data sources are created at the time the domain is created) or
- creating them through WebLogic Admin Server console (see sample below).
3.2.4.2 Data Source for connecting to an Oracle RAC database that is running on multiple machines
To support Oracle RAC features within Oracle WebLogic Server, Oracle recommends using Oracle WebLogic Server GridLink Data Source. A single GridLink data source provides connectivity between WebLogic Server and an Oracle Database service targeted to an Oracle RAC cluster. It uses the Oracle Notification Service (ONS) to adaptively respond to state changes in an Oracle RAC instance. An Oracle Database service represents a workload with common attributes that enables administrators to manage the workload as a single entity.
To configure this, the following steps need to be performed. For more details about GridLink Data Source configuration, see the Oracle WebLogic Server documentation in http://download.oracle.com/docs/cd/E17904_01/web.1111/e13737/gridlink_datasources.htm.
3.2.4.2.1 Configuring GridLink Data Source
Step 1: Login to the WebLogic admin server console and click the Services/Data Sources link.
Step 2: Click on New button and select the option GridLink Data Source
In WebLogic Production-mode use the Lock & Edit button before clicking on the New button.
Step 3: Change the value of Name to ohi-application-datasource and enter jdbc/vbpUserOhiApplicationDSinJNDI Name. Click the Next button.
Step 4: In Transaction Options page, accept the default settings (Supports Global Transactions and One-Phase Commit) and click the Next button.
Step 5: If SCAN (Single Client Access Name) is used for the Oracle RAC database, select the option Enter complete JDBC URL. Else, select the option Enter individual listener information.
Step 6: In Connection Properties page either
- enter the values of various fields as outlined in the table below if option Enter complete JDBC URL is selected:
Parameters |
Value |
Explanation |
---|---|---|
Complete JDBC URL |
jdbc:oracle:thin:@{scan-listener-host}:{scan-listener-port}/{service-name} |
JDBC URL using SCAN |
Database User Name |
ohi_vbp_user |
Fixed value, do not change |
Password & Confirm Password |
Password of "ohi_vbp_user" |
The schema password as selected during the installation |
- or enter the values of various fields as outlined in the table below if option Enter individual listener information is selected:
Parameters |
Value |
Explanation |
---|---|---|
Service Name |
Oracle RAC service name |
|
Host and Port |
hostname1:port hostname2:port |
Individual RAC node details. The format is <HOSTNAME>:<PORT> |
Database User Name |
ohi_vbp_user |
Fixed value, do not change |
Password & Confirm Password |
Password of "ohi_vbp_user" |
The schema password as selected during the installation |
Step 7: In Test GridLink Database Connection page, click on Test All Listeners to see if the connection is successful. Once the test connection succeeds, click on Next button.
Step 8: Enter the details of ONS client configuration as outlined in the table below and click the Next button.
Parameters |
Value |
Explanation |
---|---|---|
Fan Enabled |
Check-box selected |
Enables the data source to subscribe to and process Oracle FAN events. This attribute is only applicable for RAC configurations that publish FAN notification events using the ONS protocol. |
ONS Nodes |
Eg: hostname1:6200,hostname2:6200 |
A comma-separated list of ONS daemon listen addresses and ports to connect to for receiving ONS-based FAN events. |
ONS Wallet File |
Location of ONS Wallet File (including the file name) |
The location of the Oracle wallet file in which the SSL certificates are stored. Only required when the ONS client is configured to communicate with ONS daemons using SSL. |
ONS Wallet Password & Confirm ONS Wallet Password |
The wallet password |
The wallet password attribute that is included as part of the ONS client configuration string. This attribute is only required when ONS is configured to use the SSL protocol. |
Step 9: Click on Test All ONS Nodes to see if the connection is successful. Once the connection test succeeds, click the Next button.
Step 10: Select the Target(s) in the next page and click the Finish button.
Make sure to specify the managed server as target for the GridLink Data Source and change the connection pool settings by executing the following steps:
- Select the newly created GridLink Data Source
- Click on the tab Connection Pool
- Expand the Advanced node at the bottom of the page to display all properties and set the following:
Property |
Value |
---|---|
Initial Capacity |
0 |
Test Connections On Reserve |
Checked |
Test Frequency |
300 |
Connection Creation Retry Frequency |
30 |
Seconds to Trust an Idle Pool Connection |
10 |
Set the following driver property:
Property |
Value |
---|---|
oracle.net.CONNECT_TIMEOUT |
10000 |