var sqlQuery = 'SELECT * FROM users, authorities where users.authorities_authoritiesID = authorities.authoritiesID';
var con = connectMysql();
closeMysqlConnection(con);
function getDatabaseContent(con, res, sqlQuery) {
con.query(sqlQuery,function(err,rows){
if(err) throw err;
console.log('Data received from Db:\n');
console.log(rows);
});
}
function connectMysql() {
var mysql = require("mysql");
// First you need to create a connection to the db
var con = mysql.createConnection({
host: "localhost",
user: "root",
password: "",
database: "hostingInfoTrackSys"
});
return con;
}
function closeMysqlConnection(con) {
con.end(function(err) {
// The connection is terminated gracefully
// Ensures all previously enqueued queries are still
// before sending a COM_QUIT packet to the MySQL server.
});
}