Deploy the Java web application to HANA Cloud

Here we deploy the war directly to the SAP HCP( HANA Could Platform) not from the Eclipse. Yes they do have written some tools for eclipse where we can connect to HANA Could and we can deploy from the eclipse.

In this we see the steps to deploy the Java Web application to SAP HCP. You need to follow some steps while developing the Dynamic web application in eclipse follow the below post for

  1. Creating the Dynamic web application
  2. Creating the HANA Database
  3. Creating the HANA Datasource binding
  4. Configure HANA database with Hibernate + JPA

Here we use the trail HANA Cloud account so we can deploy only one application.

1: Login to the SAP HCP Cockpit

2: Click on the “Java Applications” from the left side Navigation panel.

3: Click on “Deploy Application”. if you already have one you can delete the application but need to stop the application before deleting.(Note : if the binding is already created select the check box to say not to delete the binding).

4: Select the war file


5: The name of the application will be generated automatically based on war file name.

6: Runtime has to select very carefully, check this link to chose Runtime, in our example we will use “Java Web Tomcat 7”

7: Other Things dont change, these are related to process and CPU’s other stuff we will not worry now.( even i dont know much about these, i have trail version 😦 ). these can be configured when we have licence in trail version they have some limitations.

8: Click “Deploy”, it will upload the .war file the it ask to start.

9. if you already have the data binding created you can start. Other wise just close.

10. To create binding follow the post last section.

11. Then Start the Application from SAP HCP Cockpit.




Hibernate + JPA + Spring-data-jpa + HANA Database

In my previous post we have created a HANA Database(Row) and we have created a Web application to create and see the Users with MySQL

Now lets change the application to work with HANA DB and In SAP HANA Cloud Platform.

1: We need to Access the Database Using JNDI Data Source, Change the Data Source Name as below in the (see the post User App With MySQL)

 public DataSource getDataSource() {
 final JndiDataSourceLookup dsLookup = new JndiDataSourceLookup();
 DataSource dataSource = dsLookup.getDataSource("jdbc/DefaultDB");
 return dataSource;

If You are using the HANA Cloud Trail Version we can create only one DataSource that is so the datasource name should be “jdbc/DefaultDB”, other name will not be considered. (Creating the Datasource Name(binding) for the HANA Database we will see in the next step).

2: Change the Hibernate Dialect in the hibProperties() method in the (see the post User App With MySQL)

Properties properties = new Properties();

Dialect is “org.hibernate.dialect.HANARowStoreDialect” Because we have created Row Databse.

hibernate.default_schema should be Database user name which we have created for the Database(refer my previous post ), because the HANA will create the Schema in the USERNAME. I think its only for Trail version.

3: We need to Create the (Data Source Bindings) for the HANA Database.

To do this first we need to deploy the Java application first. follow the post to Deploy the Java web application.

After deploying the application login to the SAP HANA Cloud Platform Cockpit

  1. Click on the “Databases & Schemas”, select the Database which you need to bind for this application
  2. Now we can see the overview screen
  3. Select “Data Source Bindings” from the left navigation panel.
  4. click on “New binding”binding
  5. Data source name Should be , see the Step 1.
  6. select the Java Application
  7. Give the user name which is created in the previous post.
  8. password for the User.

Need to restart the Java Application to take new binding.

Source Code

SAP HANA Cloud Developer Account Creation

SAP Will give the Developer trail account for Cloud

Which is

  • Only one JAVA application can be deployed
  • And HANA DB will stopped every day.
  • And after 7 days the HANA DB will be removed.

If you are ok with these go ahead and try. Otherwise buy Licence from SAP 😉

While creating account go with this link

HCP Developer Page

Otherwise it will not enable BETA features,


Where i have created the SAP Account First then started using the SAP HANA Cloud Account so i cannot use the Tomcat 8 which is BETA (while writing this article).

In the HCP Developer Page Click on sign up for Free account>Try now

That will take you to the Login page

click on Register and give you details

The Activation link will come to your mail, which is given while registering.

Open the Mail and Activate.

After that you can use the SAP HCP Cockpit link to login

SAP HANA Cloud Platform Cockpit