Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var connection = mysql.createConnection({
- host :'localhost',
- user : 'root',
- password : 'secret',
- port:3000
- });
- connection.connect();
- //connection.query("SET SESSION wait_timeout = 604800");
- connection.query('CREATE TABLE t1(id int)', function(error, rows, fields) {
- if (error){
- throw error;
- }else{
- console.log(rows);
- }
- });
- connection.query('select * from t1', function(error, rows, fields) {
- if (error){
- throw error;
- }else{
- console.log(rows);
- }
- });
- function keepalive() {
- connection.query('select 1', [], function(err, result) {
- if(err) return console.log(err);
- // Successul keepalive
- });
- }
- setInterval(keepalive, 1000*60*5);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement