Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // https://github.com/felixge/node-mysql/
- var query = "select sleep(1), id from blog_post limit 1;"
- var mysql = require('mysql');
- var pool = mysql.createPool({
- connectionLimit : 100,
- host : 'localhost',
- user : 'root',
- password : '123',
- database : 'kodoman',
- });
- for (var i=0; i<100; ++i) {
- pool.query(query, function(err, rows, fields) {
- if (err) throw err;
- console.log(rows);
- });
- }
- setTimeout(function () {
- pool.end(function (err) {
- // all connections in the pool have ended
- });
- }, 2100)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement