How to establish pool connection in node-mysql? Can anyone provide me the syntax?
Try this:
function Pool(num_conns)
{
this.pool = [];
for(var i=0; i < num_conns; ++i)
this.pool.push(createConnection()); // your new Client + auth
this.last = 0;
}
Pool.prototype.get = function()
{
var cli = this.pool[this.last];
this.last++;
if (this.last == this.pool.length) // cyclic increment
this.last = 0;
return cli;
}