Demo: Building Java Apps with Bluemix and DB2
Controlling application life cycle is not a trivial task. In the cloud computing world, PaaS abstracts many of the complexities related to hosting and managing applications. From the demo, you can learn about some options for application deployment, management, and monitoring that are available in Bluemix.
Taking care of the underlying infrastructure, PaaS solutions allow developers to focus on their application code. Watch the video to see how to build a Java Web application with Bluemix and extend the application functionality by binding the SQL Database service to it. Interaction with the Bluemix UI and the Cloud Foundry CLI is also discussed in the webinar.
The webinar focuses on the initial phase of Java Web application development with IBM Bluemix. The suggested scenario can be boiled down to three core parts:
- Creating a Java Web application in the Bluemix UI
- Modifying the application and pushing it to Bluemix
- Adding the SQL Database service and connecting to it for further interaction
Creating a Java Web application in the Bluemix UI
To create a Java Web application in the Bluemix UI, Stefano performs a number of standard steps in his Bluemix account:
- On the Dashboard, clicks Create App and then Web.
- Selects the Liberty for Java runtime as a starter and specifies the application name.
- For deploying and modifying the application and service instances, chooses the Cloud Foundry CLI.
Find more information about creating Web applications in IBM Bluemix documentation.
Modifying the application and pushing it to Bluemix
After the Liberty for Java starter application has been downloaded from the Bluemix UI and the package has been extracted to a new local directory, Stefano modifies the application in Eclipse.
The shown in the webinar procedure of pushing the modified application to Bluemix with the Cloud Foundry CLI includes several actions:
- When you have changed to the new directory using the
cdcommand, connect to Bluemix:
cf api https://api.eu-gb.bluemix.net
api.eu-gb.bluemix.netis the Cloud Foundry API endpoint for Bluemix Europe United Kingdom region.
- Log in to Bluemix:
cf login -u user_name -o org_name -s space_name
- Upload your app to Bluemix with the
Refer to IBM Bluemix documentation to know more about deploying and modifying applications and service instances with the Cloud Foundry CLI.
Adding the SQL Database service and connecting to it
From the final part of the webinar, you can find out how to add IBM SQL Database for Bluemix as a managed relational database service and then connect to it.
For requesting a service instance, Stefano works with the Bluemix UI, selecting the DB2-based SQL Database service from the Bluemix catalog. At this point, Bluemix binds the service instance to the application.
Then Stefano configures the application to interact with the SQL Database service. For connecting to the service, he uses information in the
VCAP_SERVICES environment variable.
As shown in the video, the
VCAP_SERVICES credential information becomes available on the application page in the Bluemix UI after a SQL Database instance has been bound to the application.
When the SQL Database service is ready for interaction, Stefano demonstrates inserting and selecting data as an example.
See IBM Bluemix documentation for getting started with the SQL Database service.
As a crucial component of the Cloud Foundry architecture, buildpacks provide runtime environments for different classes of applications.
In Bluemix, Liberty for Java application development is powered by the IBM WebSphere Liberty Buildpack, a Cloud Foundry buildpack for running Java EE 7 and OSGi applications on top of the IBM WebSphere Application Server Liberty Profile. The buildpack supports popular frameworks such as Spring and contains the IBM JRE.
Besides the SQL Database service presented in the webinar, other relational and non-relational database services are available in the Bluemix catalog. Watch this video to know how Bluemix and Cloudant can be used for building scalable IoT applications.
For further exploration of IBM Bluemix and its capabilities, top 10 Bluemix tutorials—2015 might be helpful.
Want details? Watch the video
Table of contents