javaeclipsehanasap-business-technology-platform

Running Java Web App with HANA Database locally


I just started working on a Java web application using SAP Cloud Platform with a HANA Database, and I don't fully understand how to test it locally.

I managed to create and successfully deploy the web app on SAP Cloud Platform, using a HANA Database, with Spring MVC and Hibernate. What I want to know is if there's a way to run the application locally, connecting it to the same database.

I've read plenty of tutorials and it seems that I need to install the SAP Hana Cloud Tools for Eclipse and connect Eclipse to the database (which I did), and when I run the app on the local server, it should connect to the database, but it doesn't.

How should I proceed? Do I need to somehow replicate the database locally or I can connect to the database in the cloud? Is the SAP Cloud Connector related to this? Which is the standard way of working with this platform?

Thanks in advance.


Solution

  • After many hours searching, I finally got it. In case someone else is struggling with this:

    You need to configure the connection.properties file of you local Tomcat Server (Server > Java Web Tomcat 8 Server-config/config_master/connection_data), to point to the right database. The usual configuration parameters for HANA are:

    javax.persistence.jdbc.driver=com.sap.db.jdbc.Driver
    javax.persistence.jdbc.url=jdbc:sap://<host>:<port>/?reconnect=true&autocommit=false // you need to connect to your cloud database with HANA Studio in Eclipse first. Mine ended up being localhost:30015
    javax.persistence.jdbc.user=db-user
    javax.persistence.jdbc.password=db-pass
    eclipselink.target-database=HANA
    

    Cheers.