Skip to content

SAP DBTech JDBC: Cannot connect to jdbc:sap://… on SCP

I’m running a Java application in the SAP Cloud Platform that connects to a shared HANA DB using JDBC. Out of a sudden (no code changes, no deployments, no config changes…) the application can no longer connect to the database. The logs/stacktrace says:

Failed to get connection from datasource
SAP DBTech JDBC: Cannot connect to jdbc:sap:// [Cannot connect to host [Connection refused (Connection refused) (local port 54468 to address, remote port 30015 to address xx.yyy.zzz.250 (], -813.].


There is a SAP note: 2501339 – Error: “SAP DBTech JDBC: Cannot connect to jdbc…” occurs when connecting tenant DB by using JDBC driver which suggests to change a port in the connection settings.

I never set any port manually and the described steps in proposed solution do not apply to my problem except for the same error message.


The problem could be resolved by deleting and recreating the existing Data Source Binding for my application in the SAP Cloud Platform Cockpit; available under the “Configuration” menu item. I couldn’t specify any port there (and never did) but deleting and recreating it with the same name somehow seemed to solve the problem under the hood.

(I restarted the application after recreating the binding. Not sure if this was necessary though.)