Tuesday 20 June 2017

Problems using socket connection for mysql calls.

I have an app hosted on heroku and a database that is behind a firewall. The firewall can't be opened to all traffic so I looked into options and came across fixie socks (the only free option).I am using connection pooling for my dbcalls. Previously I could make consecutive calls:pool.getConnection(function gotConnection(err, connection) { if (err) throw err; connection.query('SELECT 1+1 as test1;', function (err, rows, fields) { console.log('Result: ', rows); connection.release(); }); }); pool.getConnection(function gotConnection(err, connection) { if (err) throw err; connection.query('SELECT 2+2 as test1;', function (err, rows, fields) { console.log('Result: ', rows); connection.release(); }); }); pool.getConnection(function gotConnection(err, connection) { if (err) throw err; connection.query('SELECT 3+3 as test1;', function (err, rows, fields) { console.log('Result: ', rows); connection.release(); }); }); Now however when I try the same thing I get the followingWarning: got packets out of order. Expected 1 but received 0 If I do a single call then it works fine, but the minute I put a 2nd one in, I get the packets out of order error. Can anyone give me some insight into what I am doing wrong? Or what I need to do differently using a stream and a socket.

Submitted June 20, 2017 at 06:55PM by azazael13

No comments:

Post a Comment