Jasmine Shah
Jasmine Shah

Reputation: 25

How to create mysql connection with pool request?

how include Setup Connections and Parser?

var mysql   = require('mysql');
var pool = mysql.createPool({
   host     : 'localhost',
   user     : 'medb',
   password : '123458',
   database : 'test',
   connectionLimit: 100
});

What would be next ?

Upvotes: 1

Views: 88

Answers (1)

Ashish Gupta
Ashish Gupta

Reputation: 1241

Hi this is complete step to get mysql connection with pool request.

var mysql   = require('mysql');

//Setup Connections and Parser
var pool = mysql.createPool({
    host     : 'localhost',
    user     : 'me',
    password : '12345',
    database : 'A2014',
    connectionLimit: 100
});

pool.getConnection(function(err, connection) {

    connection.query( 'select count(9) from mytbl;', function(err, rows) {
    connection.release();
    });
    pool.end();
});

Upvotes: 1

Related Questions