Demo: Building Java Apps with Bluemix and DB2

by Victoria FedzkovichAugust 20, 2015
In this webinar, Stefano Sbanchi of IBM demonstrates how to develop, deploy, and scale Java Web applications with IBM Bluemix and its SQL database service powered by DB2.
Why read this?

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:

  1. On the Dashboard, clicks Create App and then Web.
  2. Selects the Liberty for Java runtime as a starter and specifies the application name.
  3. 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:

  1. When you have changed to the new directory using the cd command, connect to Bluemix:
    cf api
    where is the Cloud Foundry API endpoint for Bluemix Europe United Kingdom region.
  2. Log in to Bluemix:
    cf login -u user_name -o org_name -s space_name
  3. Upload your app to Bluemix with the cf push command.

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.

Altoros Take

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

  1. Introduction to IBM Bluemix (0:05)
  2. Creating a Java Web application in the Bluemix UI (6:55)
  3. Downloading the Liberty for Java starter application (9:15)
  4. Modifying the application (10:44)
  5. Pushing the modified application to Bluemix (14:25)
  6. Adding the DB2-based SQL Database service (21:39)
  7. Connecting to the SQL Database service (23:30)
  8. Interacting with the SQL Database service (29:49)



About the speaker

Stefano Sbanchi is a Cloud Platform Services Architectural Advisor at IBM. With his extensive experience in software development, he works as an IBM Bluemix representative for Italy. Stefano holds a Master’s Degree in Internet Technology from the University of Pisa.