Using Database Objects in a Java Cloud Application
By Niranjan Kumbi-Oracle on Jul 11, 2014
Java Cloud service subscription is accompanied with a limited storage database cloud service(DBaaS). Some of you may not be aware of the technical details involved in retrieving data from a cloud schema (DBaaS).
First step is to identify the JNDI name aka Service name of the DBaaS schema. When you login into cloud.oracle.com account, you would see a listing of all the services available under your account. Look for 'Service Name' column.
Clicking on the Java service link would also show you the list of data sources that your JCS instance has access to.
Once you have identified the data source, follow same steps as you would normally do to create a JDBC client. Ensure you refer the right data source string that you identified in previous step.
After you have retrieved the connection, you would write standard JDBC code to query records or invoke PLSQL procedures.
Working with ADF:
For those familiar with ADF, it is possible to build a JCS client application with ADF. Choose a standard Model/Viewcontroller template, and then create an Application Module in the Model project. In AppModule configuration change the AppModuleShared and AppModuleLocal configuration to point to data source name of database service associated with java cloud service.
To deploy the application to Java Cloud Service, configure EAR deployment properties under Application properties to set the platform as 'Oracle Cloud'.
The application is now ready to be deployed to Java Cloud.
Defining schema objects in DBaaS:
DBaaS login gives you access to Oracle Application Express(Apex) dashboard. One could define DB objects, PLSQL procedures and scripts that are needed for your Java App through a browser based interface.