cancel
Showing results for 
Search instead for 
Did you mean: 

Host Unknown: Connect to SAP Hana using JDBC url from local java springboot application

sukhpreet_k68
Explorer
0 Kudos

I need to connect to SAP Hana (running on Neo cloud) from my local Java Spring Boot application using STS (runs on eclipse 2018-12; Cloud Platform Tools not available).

My pom.xml has dependency com.sap.cloud.db.jdbc > ngdbc

Using application properties:

spring.datasource.url=jdbc:sap://hana-***:<port>
spring.datasource.username=<username>
spring.datasource.password=<password>
spring.jpa.hibernate.naming_strategy=org.hibernate.cfg.EJB3NamingStrategy
spring.jpa.properties.hibernate.dialect = org.hibernate.dialect.HANAColumnStoreDialect
spring.jpa.properties.hibernate.jdbc.lob.non_contextual_creation=true

But the application startup is failing with com.sap.db.jdbc.exceptions.JDBCDriverException (unknown host).

Any suggestions on what could be missing?

View Entire Topic
amontella96
Active Contributor

hi sukhpreet_k68, answer from vitaliy.rudnytskiy is "kind of right", i think neo's names are actually visible in public but NOT on the ports you need for your goal. You can test this with op.sys. commands like telnet hana-*** port

There s a nice blog from jerry.wang that should give you the infrastructure knowledge...

good luck!A

sukhpreet_k68
Explorer

Thanks for the link! I did stumble upon this initially. However, the properties javax.persistence.jdbc.* mentioned in said blog didn't work with the dependencies I had. The following properties did the trick:

spring.datasource.url=jdbc:sap://localhost:<port configured with cloud connector>
spring.datasource.username=<username>
spring.datasource.password=<password>
spring.jpa.hibernate.naming_strategy=org.hibernate.cfg.EJB3NamingStrategy
spring.jpa.properties.hibernate.dialect = org.hibernate.dialect.HANAColumnStoreDialect