{"action":"closed","issue":{"url":"https://api.github.com/repos/felixge/node-mysql/issues/1047","labels_url":"https://api.github.com/repos/felixge/node-mysql/issues/1047/labels{/name}","comments_url":"https://api.github.com/repos/felixge/node-mysql/issues/1047/comments","events_url":"https://api.github.com/repos/felixge/node-mysql/issues/1047/events","html_url":"https://github.com/felixge/node-mysql/issues/1047","id":66542420,"number":1047,"title":"Option required to start TRANSACTION ","user":{"login":"sapkal-manish","id":1754555,"avatar_url":"https://avatars.githubusercontent.com/u/1754555?v=3","gravatar_id":"","url":"https://api.github.com/users/sapkal-manish","html_url":"https://github.com/sapkal-manish","followers_url":"https://api.github.com/users/sapkal-manish/followers","following_url":"https://api.github.com/users/sapkal-manish/following{/other_user}","gists_url":"https://api.github.com/users/sapkal-manish/gists{/gist_id}","starred_url":"https://api.github.com/users/sapkal-manish/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sapkal-manish/subscriptions","organizations_url":"https://api.github.com/users/sapkal-manish/orgs","repos_url":"https://api.github.com/users/sapkal-manish/repos","events_url":"https://api.github.com/users/sapkal-manish/events{/privacy}","received_events_url":"https://api.github.com/users/sapkal-manish/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/felixge/node-mysql/labels/question","name":"question","color":"d4c5f9"}],"state":"closed","locked":false,"assignee":{"login":"dougwilson","id":67512,"avatar_url":"https://avatars.githubusercontent.com/u/67512?v=3","gravatar_id":"","url":"https://api.github.com/users/dougwilson","html_url":"https://github.com/dougwilson","followers_url":"https://api.github.com/users/dougwilson/followers","following_url":"https://api.github.com/users/dougwilson/following{/other_user}","gists_url":"https://api.github.com/users/dougwilson/gists{/gist_id}","starred_url":"https://api.github.com/users/dougwilson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dougwilson/subscriptions","organizations_url":"https://api.github.com/users/dougwilson/orgs","repos_url":"https://api.github.com/users/dougwilson/repos","events_url":"https://api.github.com/users/dougwilson/events{/privacy}","received_events_url":"https://api.github.com/users/dougwilson/received_events","type":"User","site_admin":false},"milestone":null,"comments":7,"created_at":"2015-04-06T06:49:27Z","updated_at":"2015-04-09T05:13:28Z","closed_at":"2015-04-09T05:13:28Z","body":"I have created pool cluster in my app as follows :\r\n```js\r\nvar mysql = require('mysql');\r\nvar poolCluster = mysql.createPoolCluster();\r\n\r\n//This is MASTER for both 'read' as well as 'write'\r\npoolCluster.add('READ-WRITE', {\r\n    host: 'rds.amazonaws.com', \r\n    user: 'user1',\r\n    password: 'pswrd1',\r\n    database: 'Database1',\r\n    multipleStatements : true,\r\n    debug: false,\r\n    connectionLimit: 200,\r\n//  queueLimit : 0,\r\n//  waitForConnections : false\r\n    timezone : '+05:30'  \r\n});\r\n\r\n//This is SLAVE (read-replica) for both 'read' queries\r\npoolCluster.add('READ', {\r\n    host: 'read-replica1.rds.amazonaws.com', \r\n    user: 'user1',\r\n    password: 'pswrd1',\r\n    database: 'Database1',\r\n    multipleStatements : true,\r\n    debug: false,\r\n    connectionLimit: 200,\r\n//  queueLimit : 0,\r\n//  waitForConnections : false\r\n    timezone : '+05:30'  \r\n});\r\n\r\npoolCluster.on('remove', function (nodeId) {\r\n    console.log('REMOVED NODE : ' + nodeId); // nodeId \r\n});\r\n\r\nfunction executeQuery(query, readQuery ) {\r\n\r\n    //Question1: Here I want TRANSACTION (connection.beginTransaction() ), when my 'readQuery' variable = false, means every \"READ-WRITE' queries should be warped with 'TRANSACTION', not read query. \r\n\r\n    //Question2: If I write my code in following style, Does 'pooling' feature used?\r\n\r\n    poolCluster.of((readQuery ? \"READ\" : \"READ-WRITE\"), 'RANDOM').getConnection( \r\nfunction(err,     connection) {\r\n    console.log('connected id ' + connection.threadId); //Here I am not getting threadId, why ?????\r\n\r\n    connection.query(query, function(err, rows, fields) {\r\n         connection.release(); //send back to pool\r\n    });\r\n})\r\n\r\n}\r\n```\r\nIn short (about 1 question), I need on option in `getConnection()` method, to start TRANSACTION."}}