Database: connecting to mysql using javascript

“Sorry for my English”
have you ever used JavaScript to connect to a MySQL database?
using a “Code” block, I wrote the following code, but it always reports an error, even on the second line :flushed:

var testerr = " non ancora connesso";
var mydbs = require(‘mysql’); // <— error :hot_face:

var con = mydbs.createConnection({
host: “hostxxx”,
user: “Sqlxxxx”,
password: “password”,
database: “MyDatabasexx”

con.connect(function(err) {

if (err) throw err;
testerr = “Connesso”;
con.query("SELECT * FROM app_stato", function (err, result, fields) {
if (err) throw err;
Return the fields object:
var valoridb = fields ;
//var valoridb = fields[0].name;

Thank you so much :innocent:

Voiceflow’s code block seems it’s very limited and basic JavaScript(Node.js) environment. you can not add any packages.

1 Like

therefore, it cannot execute the code to open mysql ?? :astonished:

Thank you

unfortunately, no…:cry:

but you can try airtable via integration block. there are many topics and some tutorials here.

OK thanks
, but my intention was to avoid having another database, considering that I already use Mysql.
Thanks so much