I have two enterprises, and both have separate DBs. And when I select these enterprises through the drop-down, I want to change my DB connection with that option.
1 Answer
const conn = require('./connection.js'); // your path
conn.changeUser({database : 'databasename'}, function(err) {
if (err) throw err;
});
3 Comments
shubham chhapre
is this possible to username & password of db?
Shubham Azad
** yes you can do.** user: The name of the new user (defaults to the previous one). password: The password of the new user (defaults to the previous one). charset: The new charset (defaults to the previous one). database: The new database (defaults to the previous
PHP Geek
Shubham can you please show you connection.js file, I am handling same thing with a bit different funtionality.