Skip to Content
0
Jan 07 at 05:42 PM

How to connect BTP Foundry ( Nodejs ) with DB ( Mysql ) on Premise

116 Views

Hello,

Im having trouble connecting a nodejs app on foundry with a mysql DB on premise via SCC.

When i try the app on premise its working fine, i am using a mysql npm package.

var mysql = require('mysql');
var getCon = async function (host, port, password) {
    return new Promise(function (resolve, reject) {
         var con = mysql.createConnection({
             host: "localhost",
             user: "root",
             password: "password"
         });
       
        con.connect(function (err) {
            if (err) throw err;
            console.log("Connected!");
            resolve(con);
        });
    });
}

So i upload the app to foundry and configure the SCC accordingly, with a TCP connection to my localhost and 3066 port, and configure also the destination with the virtualhost ( tested ok ).

But when i run the app , it appears to ignore the destination and got an error that the server is not maybe because it is not a HTTP connection , but a TCP.

So is there a way to do this, with nodejs?

Here is the destination.

image.png

And the error

image.png

There is this post about TCP connection, but is only for JAVA, is there a way to make it work in nodejs?

https://help.sap.com/products/CP_CONNECTIVITY/b865ed651e414196b39f8922db2122c7/c2461c31761b488c828e15b71263f3fd.html?locale=en-US

Thanks in advance,

Greetings.

Attachments

image.png (14.8 kB)
image.png (29.3 kB)
image.png (61.9 kB)