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

Import SHP to HANA Spatial

So in order to load shape file into HANA you need to perform the 4 simple steps stated below:-

  1. Download Putty( and PSCP(
  2. Copy the shape file(zip it first) from your local machine into HANA using PSCP
    C:\<path to PSCP directory>>pscp.exe  <source file> <OS_Username>@<HANA _server name>:<destination folder>
  3. You can login to you server using putty and unzip the files.
  4. You can import the shape files in HANA by running the below command

IMPORT “Schema_Name”.”Table_Name” AS SHAPEFILE FROM ‘path to shape file’
        Note: Don’t give the extension of the shape file in the path. Just mention its name.


Source :