简体   繁体   中英

I got an Error (ETIMEOUT) when I try to Post Data with node js into an SAP HANA Database

I'm trying to post data to the HANA database with Node.js. Now I get this error:

 "Error: connect ETIMEDOUT 141.**.**.***:3051 at TCPConnectWrap.afterConnect [as oncomplete]". 

My code looks like this:

 var http = require('http'); var httpOptions = { host: 'h05-d02.ucc.ovgu.de', path: '/gbi013/oData/SensorData.xsodata/SENSOR_DATA', method: 'POST', port: 30515, headers: { 'Authorization': 'Base64', 'Content-Type': 'application/json' } }; updateHANA(); function updateHANA() { var req = http.request(httpOptions).on('error', function(err){ console.error(err); }); var jsonData = { "ID": 13, "TEMPERATURE": "22.99", "HUMIDITY": "33.33", }; var strData = JSON.stringify(jsonData); console.log(strData); console.log(req.statusMessage) req.write(strData); req.end(); }; 

Where did I make a mistake? I'm an absolute beginner. I hope someone can help me. Thanks!

At first sight, I'd say the port you try to bind your service to 30515 in the httpOptions variable is wrong. The error message could be interpreted in a way that the http module only considers the first 4 digits 3051 and fails to connect to it due to a timeout (which makes sense if there is no service listening on this port).

Your choice of port is odd, too. It looks very much like the SQL communcation port of a default tenant database in HANA (if the system's instance number is 05 ).

So, maybe you want to try this with a more "traditional" service port, like 80 or 8080 first and if that works you can check what is blocking you from using port 3051 (could also be eg a firewall blocking the port).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM