cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

SAP BAS, sap/hana-client and SAP HANA on-prem: “Cannot resolve host name”

marco_spyker
Explorer
0 Kudos
693

Hello everyone!

We are trying to access our SAP HANA on-premise database within SAP BAS, but we are already having problems logging in because the host cannot be resolved:

 

 

Error: Connection failed (RTE:[89001] Cannot resolve host name 'hana.on_prem.local' rc=-2: Name or service not known (hana.on_prem.local))

 

 

 

Here is the small mini script (nodejs sap/hana-client):
marco_spyker_0-1741271563797.png

If we run this code locally in VS Code while we are in the company network, the host can be resolved and we can successfully connect to our SAP HANA on-premise, so we suspect the error is in the BTP or CloudConnector.


The associated Cloud Connector in the BTP subaccount is properly set up and "reachable":

 
marco_spyker_1-1741271594763.png
marco_spyker_0-1741271879949.png

 


 

 Do we need to specify anything else in the parameters for the “conn.connect…” call?
Perhaps location_id or something similar?

Is our assumption correct that “conn.connect…” uses a TCP connection?

Do we then need SOCKS5? If so, how do we set this up?

https://help.sap.com/docs/connectivity/sap-btp-connectivity-cf/using-tcp-protocol-for-cloud-applicat...

We are grateful for any advice!

Many thanks and best regards,

Marco

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Accepted Solutions (0)

Answers (1)

Answers (1)

simon_luser
Product and Topic Expert
Product and Topic Expert
0 Kudos

I'm not an expert for this hana-client library, but you need to somehow specify that the connection should be tunnelled via Cloud Connector. I have found something like proxy_scp_account and proxy_userid here.

marco_spyker
Explorer
0 Kudos

Hi @simon_luser,

Thank you for your response.

Just to confirm, our understanding is correct that the connection utilizes TCP rather than HTTPS protocols? During our additional testing with the Cloud Connector, we observed that all configured HTTP connections work as expected. However, when attempting to use TCP, we consistently encounter the aforementioned error.

Would you happen to know if any additional configuration is required on the Cloud Connector side to support TCP connections?

Looking forward to your insights.

Best regards,
Marco

Dan_vL
Product and Topic Expert
Product and Topic Expert
The following tutorial (step 5) may also be of some help. https://developers.sap.com/tutorials/hana-clients-cf.html
simon_luser
Product and Topic Expert
Product and Topic Expert
0 Kudos
I don't know if this lib uses TCP, I assume yes, for Cloud Connector there is no further configuration necessary besides the backend mapping.
Ulrich_Schmidt1
Product and Topic Expert
Product and Topic Expert
0 Kudos

The Connectivity Service has two entry points: towards the application/Cloud VM it acts as a SOCKS5 proxy and towards the Internet it listens for incoming tunnel connections from the Cloud Connector. So to put all the puzzle pieces together, you probably need to do something along the following steps:

  • Read the necessary credentials, hostname and port for the SOCKS5 proxy from the environment variables as outlined in "Using the TCP Protocol for Cloud Applications" referenced by you.
  • Tell the database client to use this SOCKS5 client when establishing the connection, using the connection parameters described in the document referenced by Simon above.
  • As database host & port in the DB client connection parameters, use the virtual host & port as defined in the Cloud Connector

Then, if everything works fine, the following should happen:

  1. DB client opens a TCP connection to the SOCKS5 proxy and passes the desired target host & port
  2. Connectivity Service (which is the SOCKS5 proxy here) passes this information along to the Cloud Connector over the open SSL tunnel
  3. Cloud Connector looks up the virtual host & port in its table and then opens a TCP connection to the "real" host and port of the database
  4. Once this connection is established end-to-end, the DB client can then use it for sending SQL statements to the DB and receive the result sets.