Sunday 4 May 2014

Deploying ADF application to Oracle Cloud Part 3

This is the last part of 3 part series. As you already aware

In the first part I talked about Prerequisites and setting up the environment. Please find Part 1  here.

In the second part I talked about how to move database schema and corresponding data from local JDeveloper to Oracle Database cloud service. Please find Part 2 here.

The purpose of this section is to configure your ADF application in order to Deploy to Oracle Java Cloud Service. Oracle Java Cloud Service provides a platform to develop and deploy applications in the Oracle Cloud. You can deploy any Java EE applications to Oracle Cloud.

. If you want to learn more about Oracle Java Cloud Service then Click here

Step1: Creating connection to the Oracle cloud server in the JDeveloper

1.     In your JDeveloper just navigate to View -> Resource Palette -> IDE Connections -> Right click on Application server -> Create New Application server connection

In the Create Application Server Connection window, provide Connection name, select connection type as ‘Oracle Cloud’ and Click next. In the next step provide your Oracle cloud credentials details and click on next












 In the third step, you have to provide information about, Data Center, identity domain, and service name as shown below.
Are you aware of where this information will be available? If answer is “No” then no problem
Just open your Java Cloud Service and you will get all the required information as shown below.











2.     In the last step, click on Test Connection button to verify the connection is valid.



















Suppose the connection to the Oracle cloud is failed and throws the below error. 













Then don’t worry, I have faced the same issue and OTN helped me to find solution and here it is

Please check all the required details like username, password, service name, identity domain name. If everything is fine and still you are getting the same issue then problem might be with your Cloud SDK version.
If the Cloud SDK version is not latest then download the latest Cloud SDK by referring [4] in the References section below
And then unzip it somewhere and point your Java cloud service SDK location to the new version.
Cloud SDK location can be found by navigating to
 Tools -> preferences->Oracle cloud ->Java cloud service SDK.


If your connection is valid, you can see new connection to cloud server under Application server connection.










Step2: Preparing code to deploy to Oracle java cloud service

Oracle Cloud does not directly support JDBC connections, but it does support JDBC data source connections. So, we need to modify the application to use a JDBC data source and provide the name of the Oracle Database Cloud Service instance.
In order to know Data source name which Oracle Cloud provides, open Java Cloud service console page and note down JNDI name
















3.     Now in your model project right click on your application module and click on configurations, In the Manage Configurations window click on Edit button and in the Edit business configurations window change the JDBC Data Source name as shown below











If you want your application to be publicly available on the Oracle Cloud and not requiring any login credentials then add an empty login-config entry to the web.xml file:



  ......
  <!-- empty logon-config to allow anonymous access on Oracle Cloud -->
  <login-config/>
</web-app>

     I also added a welcome-file to the web.xml so requests    to xxx.oraclecloudapps.com/Application get redirected to xxx.oraclecloudapps.com/Application/faces/defaultPage:

  ......
  <!-- set welcome file so requests to / get redirected to the default page -->
  <welcome-file-list>
    <welcome-file>/faces/DeptEmpPage.jspx </welcome-file>
  </welcome-file-list>
</web-app>

4.     Now Deploy the Application to your Oracle Cloud server
i.              Click on the application ->Deploy
ii.             Deploy to Application Server
iii.            Select your Oracle Cloud Application server and click on finish












In the Deployment log, you will see something like as shown below









Once the Deployment is done, go to your Java Service Console and you can see your new application present in your Oracle Java cloud service console.







In the Application URL’s Window click on the Application URL to Test the application













Once you click on the link, you can able to see the application










If the Deployment is not successful, then you can verify log file to know the issue. In order to see the log files
Open your Java Cloud Services Control and scroll down; you can able to see the Java Cloud Service Jobs section
























As soon as you clicked on the log, the text file which contains log information will get downloaded automatically.
That’s it.

Here are some important links to invest yourself more on Oracle Cloud java service and Oracle cloud database service














Deploying ADF application to Oracle cloud Part 2

This is second part of 3 part series. In the first part, I have covered prerequisites and setting up the environment.

Please find the link for Part 1 here.


In this part, I will be going to show you how move sample HR schema and corresponding data from local JDeveloper to oracle database cloud service.
The Database Cloud Service is built on Oracle Database technology, running on the Oracle Exdata Database Machine. I am pretty sure that you all are very eager to know more about Oracle Database Cloud service.
If you want learn more on Oracle Database service, please click here Oracle Database Cloud Service

As I mentioned in Part1 our sample application uses standard HR schema from Oracle XE. If you have already installed Oracle XE database schema in your local machine then well and good otherwise please do so at least now


Step1: Creating a Local Connection to the HR schema by using Database navigator

1        Open the Database navigator by navigating View -> Database -> Database Navigator














 2.2.  In the Database Navigator , right click on IDE Connection -> Create New connection
3.     In the create Database connection window provide the proper details

Click on Test Connection, if you received “Success” message you are good to go.

If you faced any issues please refer this Click here

 Just verify the required tables, for the sample application we need COUNTRIES, DEPARTMENTS, EMPLOYEES, JOBS, LOCATIONS, PS_TXN and REGIONS tables as shown below




Step2: You need to create a user in Oracle Database cloud service that JDeveloper can use to access the database service instance to read the database
1.     Sign in to your Oracle cloud account

The information about identity domain, username and password will be there in the mail sent by Oracle Cloud. 

2. From the platform service window, open database service console as shown below. 


    3.On the Oracle Application Express screen, select Administration > Manage Users and Groups


4 4.    On the Manage users and Groups click on create user button

5. In the Create user form, provide require details.  Please note down these details somewhere safely, since this information is required later.

After providing proper details in the Create user form, click on create user button

6.Take note of the URL in the browser window (up to and including "/apex"): we need this info in feature!



Step3: Creating Connection to the Oracle Database cloud service.

1.     Create cloud connection in the JDeveloper as shown below













     2. In the Cloud connection window, provide the required details. 











    In order to get SFTP details, open Database cloud service and scroll down. In the Additional information section you will find SFTP service detail






once done, click on the ok button. You will see a new cloud connection.





















Step4: Copying Database schema and Data to Oracle Database cloud service
Oracle Database cloud service provides a facility known as Database Cart.
Database Cart:  This act like a container to hold the definition of the content that will be loaded to your database cloud service.
You just need to drag and drop the tables from database to Database cart , you also have option to select only the table structure or both table structure and data while loading data from local SQL developer to Oracle Database Cloud service.
To configure Database Cart, Navigate Tools -> Preferences -> Database (expand Database) -> Utilities (expand utilities) -> Cart -> Cart Deploy, as shown below















Now Navigate, view -> Database -> Database Cart to open Database Cart window






Now, I want move both HR schema and corresponding data from my local SQL Developer to Oracle Database Cloud service. In order do that, select the tables and drag and drop them on to Database Cart as shown below.










Select the Data check box to include the data from the tables in the transfer.











Now click on cloud icon to deploy data and schema to Oracle Cloud service as shown below









Once you clicked on Cloud icon, the Deploy objects to Cloud window will open as shown below, Provide the proper details as required
























And then click on apply button .You will see the deploy operation progress as shown below












After the above dialog box closes, you will see your deployment file under your Deployments and Double click on that to see the status of the deployment. You may see the status listed as APPROVED. After a few seconds, double-click again to refresh the status. When the status changes to PROCESSED, the tables and their data were successfully moved to the cloud.













Just to verify, expand tables in your cloud server connection to see the newly imported tables and corresponding data.


















In order to verify your data also moved properly, you can login to database cloud service console and in the Oracle Application express window click on SQL workshop -> SQL Commands and in SQL prompt run your queries to verify the data



That’s it!  We have done with Part 2 as well.