Developers building applications to be deployed in WebCenter Spaces / Portal, WebCenter Sites will need access to the database server.  There are two options to achieve this.

Option A: Create a user/password in the database and pass it to the developer team.

This option has the following dis-advantages.

  1. The username/password is hardcoded in the Application. So in future if there is a change in username/password, the change has to be made in the Application.
  2. Giving direct access to the database is not a secure option, and will compromise Database Security.

To overcome this an alternate method generally used is,

Option B: Create a Data Source in the Weblogic Server and grant access to this data source to the applications deployed to the WebCenter Spaces/Portal servers.

This option has the following advantages.

  1. The application only references the data source name. All applications running on the server can use the same Data Source to securely access the database.
  2. Any change in permissions, passwords etc., can be done centrally at the Weblogic Server Console by modifying the Data Source configuration, and the applications can remain unaffected.
  3. This also ensures that a secure access to the Database is provided.
  4. Moving WAR files from Development Environment to UAT and then to Production Environment can be done seamlessly without changing any application code. (To achieve this, a Data Source with the “same name” should be created in all (DEV, UAT, Production) environments.

Now, Let’s see how to create a “Data Source” in the Weblogic server.

Login to WeblogicServer Console and select“DataSources” from the menu on the left (under “Domain Structure” tab “Services” menu). The screen on the right displays the list of Data Sources created. Click on the NEW button at the top (as shown in the below screen), to create a new Data Source.

GJ_WLDS-1

After clicking new button, select “GenericDatasource” from ListPopup then Specify the name for Data source,JNDI Nameand Database type. In the screenshot below, we have used the following details.

Name of Data Source: Sample

JNDI Name: jdbc/testDS              >> ADF Expects ALL JNDI names used by it to end with the string DS.

Database type: Oracle (We have chosen “Oracle” here. But you could choose the name of the respective database used in your setup).

GJ_WLDS-2

then click NEXT to continue…….

GJ_WLDS-3

This screen prompts us to enter the details for the Database connection (Oracle) chosen in the previous screen.

Database Name:  The Database name given here is OWCSDB. You can replace it with the name of  your database.

HostName: – <IP-address> or hostname

Port: -The default port for Oracle is 1521. This might be different for other databases.


Click on “NEXT” button. The next screen has an option to test the configuration details entered for the Database Connection.

GJ_WLDS-4

Click on “Test Configuration” button to test the Database connection. If the Connection details entered in the previous screen are valid, and connection to database is established successfully, a success message “Connection test Succeeded” is displayed.

If there are errors, an error message is displayed. Click on “Back” button to go to the previous screen and re-enter the Database Connection Configuration details.

Once Connection test is successful, click on NEXT button to proceed.

GJ_WLDS-5The next screen, as shown above, lists all servers running in Weblogic. In this screen, select the target servers to which the Data Source needs to be deployed.

For e.g., if the server “WC_Spaces” is selected, the Data Source is deployed to this server and all applications running on this server can access the database using the “Data Source” created. Multiple servers can be selected as target servers.

The application developers need only know the Data Source Name to be included in their application, thus providing a secure access to the database.