Creating DataSource in Weblogic Console – for applications to access Database server

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.


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).


then click NEXT to continue…….


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.


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.



Bilingual Portal in WebCenter Portal & Content Internationalization


If you are working with a customer who has a global presence and needs to present information in more than one language in their public facing portal or website, you can rely on Internationalization capabilities of Oracle WebCenter.

Oracle WebCenter Portal supports internationalization for portal assets. However, if you integrate content from WebCenter Content, you need to implement your own solution to support more than one language. This post provides a simple approach to accomplish this goal. The solution described here uses out-of-the-box features of WebCenter Portal and Content, does not require any customization and supports bi-lingual content.

This solution will accomplish two goals:

  1. Present portal page content from WebCenter Content
  2. Switch to selected language content automatically when user switches to a different language (in the Portal)

The sample code referred here uses a portal named PortalLab and a WebCenter Content connection named WCC. It switches content between English (en) and Tamil (ta)

We are using WebCenter WIKI pages to surface content in Portal pages. WIKI pages can be edited in a Rich Text editor and stored in WebCenter Content and hence its life-cycle (workflow, revision and archiving) can be controlled from WebCenter Content. We use WebCenter Expression Language (EL) to select language specific content.

Let us assume that your Portal has several pages including an “About Us” page and “Contact Us” page.

1. Create a portal page named Content Administrator and set the page permissions to allow only Administrators to view the page. Edit the page and add a Document Viewer taskflow Save and view the page and add folders matching the name of each portal pages (for example: AboutUs, ContactUs etc…)

Create WIKI pages under each folder as below:

 - content_en
 - content_ta
 - content_en
 - content_ta

View the info tab for the each of the WIKI page and note down the Identifier

 WCC#dDocName: 37001
 WCC#dDocName: 37002

2. Edit the About Us portal page (Not the Folder we created, but the Portal Page) and add a Content Presenter. Edit the Content Presenter (the white wrench icon) and enter the following properties:

Data Source: #{facesContext.externalContext.requestLocale == 'en' ? 'WCC#dDocName: 37001' : 'WCC#dDocName: 37002'}

Save the portal page.

Test by visiting the page and switching the language.

Webcenter Content User Security Check in RIDC call for Specific Content 1

User Security Check in RIDC call for Specific Content

IdcClientManager m_clientManager = new IdcClientManager ();
IdcClient m_client = m_clientManager.createClient("<Your Hostname : Port>/cs/idcplg");

//RIDC superuser context
IdcContext m_superuser = new IdcContext("sysadmin", "idc");

//Examples of the three concrete cache classes
IUserSecurityCache m_SGCache = new UserSecurityGroupsCache (m_client, 20, 1000);
IUserSecurityCache m_SGAcctCache = new UserSGAccountsCache (m_client, 20, 1000, 20000);
IUserSecurityCache m_SGAcctAclCache = new UserSGAcctAclCache(m_client, 20, 1000, 20000, m_superuser);
DataBinder dataBinder = m_client.createBinder ();
dataBinder.putLocal ("IdcService", "DOC_INFO");
dataBinder.putLocal ("dID", "<dID of Specific Content>");
ServiceResponse response1 = m_client.sendRequest(m_superuser, dataBinder);
dataBinder = response1.getResponseAsBinder();

//Get the document information (typically in the first row of DOC_INFO)
DataObject docInfo = dataBinder.getResultSet ("DOC_INFO").getRows ().get (0);
IdcContext context = new IdcContext(<User Name for Whom to Check Access>,<Correct Password>);
CacheId ccID= new CacheId (context.getUser (), context);

//Get the access level for this document by this user
int access = m_SGAcctAclCache.getAccessLevelForDocument (ccID, docInfo);

//access level in Content Server form (1=Read, 3=Write, 7=Delete)

Here if access returns 1 then user have Read Access

if 3 user have Write Access
If 7 user have Delete Access

WebCenter Content Add New Link in Search Result Action Menu

Below is small snippet to add a New Link under Search Result Action Menu by idocs script in resource file,

<@dynamichtml extra_setup_search_results_action_popups@>
<$exec rsAppendNewRow("PopupProps")$>
<$exec setValue("PopupProps", "label", "<Add your label here>")$>
<$exec setValue("PopupProps", "ifClause", "<Add your Conditions here>")$>

<$exec setValue("PopupProps", "function", "<Add URL for which we need to link>")$>

<$exec setValue("PopupProps", "class", "document")$>
<$exec setValue("PopupProps", "id", "<Any id here>")$>

<$include super.extra_setup_search_results_action_popups$>


Label –> User Defined Label which should display for end User
ifClause Condition –> (dExtension like ‘doc’)
URL  –> Any url as where to link (


Add_Link (1)


How to add Menu in Content Information Page in WebCenter Content

Adding Menu in Content Information Page in Webcenter Content

To add New Menu in Content Information page we need to use “custom_docinfo_menus_setup” dynamichtml in Resource file.

<@dynamichtml custom_docinfo_menus_setup@>

<$include super.custom_docinfo_menus_setup$>

<$exec rsAppendNewRow("PageMenusData")$>
<$PageMenusData.nodeId = "<Any ID>"$>
<$PageMenusData.ifClause = "<Your Condition>"$>
<$PageMenusData.parentId = "CONTENT_ACTIONS"$>
<$PageMenusData.label = "<Your display Label>"$>
<$PageMenusData.type = "item"$>
<$PageMenusData.href = "<URL to link>"$>
<$PageMenusData.linkTarget = "_self"$>
<$PageMenusData.loadOrder = 150$>





Date formatting while using RIDC 1

RIDC API allows you to call IDC Services from Java programs. You can develop services that integrate with WebCenter Content server reliably. If you are using RIDC to check-in documents into WebCenter Content, and trying to set the Document Create Date (dCreateDate or dInDate), you should encode the date in the standard iso8601 date format (The default Content Server setting uses iso8601). You can accomplish this by using the encodeDate method of oracle.stellent.ridc.model.impl.DataObjectEncodingUtils object provided by RIDC API

The most common error if you do not format the date properly is “csDateParseError” which is caused by !syUnableToFindText,/ method and throws !syUnableToParseDate exception.

The following code shows how to encode the date

//Import the required classes:
import java.util.Date;
import oracle.stellent.ridc.model.impl.DataObjectEncodingUtils;

//Set the dCreateDate to that of a local files last modified date. 
File sourceFile = new File(localFile);
String dCreateDate = DataObjectEncodingUtils.encodeDate(new Date(sourceFile.lastModified()));

//Optionally, you can set the Date Format and Time Zone to specific values if required in the DataBinder object. 
binder.putLocal("UserDateFormat", "iso8601");
binder.putLocal("UserTimeZone", "UTC");

//Set the dCreateDate in the DataBinder object

If your Content Server date format was changed from iso8601, you can determine the setting by using the following service and then use the same in your code.

binder.putLocal("IdcService", "PING_SERVER");
binder.putLocal("tableNames", "CoreFeatures");
ServiceResponse response = idcClient.sendRequest(idcContext, binder);
//Get the User Date Format and User Time Zone since 
DataBinder resultData = response.getResponseAsBinder();
String userDateFormat = resultData.getLocal("UserDateFormat");
String userTimeZone = resultData.getLocal("UserTimeZone");

If you are still having issues with setting the date, your Managed Server logs (UCM_server1) or System Audit Trace with “systemdatabase” and “requestaudit” selected (Administration > System Audit > Tracing section), should give you more information to troubleshoot. The following is a System Audit Trace information when the date is not encoded.

>services/3 09.16 21:43:46.638 IdcServer-41011 !csUserEventMessage,weblogic,CIS!$ intradoc.common.ServiceException: !csServiceDataException,CHECKIN_NEW_SUB,makeNewRevClass!$
services/3 09.16 21:43:46.638 IdcServer-41011 *ScriptStack CHECKIN_NEW_SUB
services/3 09.16 21:43:46.638 IdcServer-41011 3:doScriptableAction,**no captured values**3:doSubService,**no captured values**CHECKIN_NEW_SUB,**no captured values**3:makeNewRevClass,**no captured values**
services/3 09.16 21:43:46.638 IdcServer-41011 at intradoc.server.ServiceRequestImplementor.buildServiceException(
services/3 09.16 21:43:46.638 IdcServer-41011 at intradoc.server.Service.buildServiceException(
services/3 09.16 21:43:46.638 IdcServer-41011 at intradoc.server.Service.createServiceExceptionEx(
services/3 09.16 21:43:46.638 IdcServer-41011 at intradoc.server.Service.createServiceException(
services/3 09.16 21:43:46.638 IdcServer-41011 at intradoc.server.ServiceRequestImplementor.handleActionException(
services/3 09.16 21:43:46.638 IdcServer-41011 at intradoc.server.ServiceRequestImplementor.doAction(
services/3 09.16 21:43:46.638 IdcServer-41011 at intradoc.server.Service.doAction(
services/3 09.16 21:43:46.638 IdcServer-41011 at intradoc.server.ServiceRequestImplementor.doActions(
services/3 09.16 21:43:46.638 IdcServer-41011 at intradoc.server.Service.doActions(
services/3 09.16 21:43:46.638 IdcServer-41011 at intradoc.server.ServiceRequestImplementor.executeSubServiceCode(
services/3 09.16 21:43:46.638 IdcServer-41011 at intradoc.server.Service.executeSubServiceCode(
services/3 09.16 21:43:46.638 IdcServer-41011 at intradoc.server.ServiceRequestImplementor.executeServiceEx(
services/3 09.16 21:43:46.638 IdcServer-41011 at intradoc.server.Service.executeServiceEx(
services/3 09.16 21:43:46.638 IdcServer-41011 at intradoc.server.Service.executeService(
services/3 09.16 21:43:46.638 IdcServer-41011 at intradoc.server.Service.doSubService(
services/3 09.16 21:43:46.638 IdcServer-41011 at sun.reflect.GeneratedMethodAccessor459.invoke(Unknown Source)
services/3 09.16 21:43:46.638 IdcServer-41011 at sun.reflect.DelegatingMethodAccessorImpl.invoke(
services/3 09.16 21:43:46.638 IdcServer-41011 at java.lang.reflect.Method.invoke(

WebCenter Resources you must know 1

Here is a quick list of websites that every Oracle WebCenter developer should be aware of:

Oracle WebCenter blog:
Proactive Support Portals:
WebCenter Content product alerts
Oracle WebCenter Homepage:
Oracle WebCenter Newsletter: