{"action":"opened","issue":{"url":"https://api.github.com/repos/oracle/node-oracledb/issues/445","repository_url":"https://api.github.com/repos/oracle/node-oracledb","labels_url":"https://api.github.com/repos/oracle/node-oracledb/issues/445/labels{/name}","comments_url":"https://api.github.com/repos/oracle/node-oracledb/issues/445/comments","events_url":"https://api.github.com/repos/oracle/node-oracledb/issues/445/events","html_url":"https://github.com/oracle/node-oracledb/issues/445","id":157949114,"number":445,"title":"Simple question about connection pooling","user":{"login":"bmulcahy","id":8929114,"avatar_url":"https://avatars.githubusercontent.com/u/8929114?v=3","gravatar_id":"","url":"https://api.github.com/users/bmulcahy","html_url":"https://github.com/bmulcahy","followers_url":"https://api.github.com/users/bmulcahy/followers","following_url":"https://api.github.com/users/bmulcahy/following{/other_user}","gists_url":"https://api.github.com/users/bmulcahy/gists{/gist_id}","starred_url":"https://api.github.com/users/bmulcahy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bmulcahy/subscriptions","organizations_url":"https://api.github.com/users/bmulcahy/orgs","repos_url":"https://api.github.com/users/bmulcahy/repos","events_url":"https://api.github.com/users/bmulcahy/events{/privacy}","received_events_url":"https://api.github.com/users/bmulcahy/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2016-06-01T16:19:47Z","updated_at":"2016-06-01T16:19:47Z","closed_at":null,"body":"This is probably more of a question about pooling then about the module itself.\r\nWhen I create a pool using \r\noracledb.createPool (\r\n  {\r\n    user          : \"hr\"\r\n    password      : \"welcome\"\r\n    connectString : \"localhost/XE\"\r\n  },\r\n  function(err, pool)\r\n  {\r\n    pool.getConnection (\r\n      function(err, connection)\r\n      {\r\n      . . .  // use connection\r\n      });\r\n  });\r\n\r\nHow do I use this pool outside of this context? Ie in a different module but within the same app.\r\n\r\nFor example I have a module that exports something like\r\n\r\nmodule.exports = {\r\n\r\nselect1: function ()\r\n{\r\noracledb.createPool (\r\n  {\r\n    user          : \"hr\"\r\n    password      : \"welcome\"\r\n    connectString : \"localhost/XE\"\r\n  },\r\n  function(err, pool)\r\n  {\r\n    pool.getConnection (\r\n      function(err, connection)\r\n      {\r\n      connection.execute(\" SQL\")\r\n      });\r\n  });\r\n}\r\n\r\nselect2: function()\r\n{\r\noracledb.createPool (\r\n  {\r\n    user          : \"hr\"\r\n    password      : \"welcome\"\r\n    connectString : \"localhost/XE\"\r\n  },\r\n  function(err, pool)\r\n  {\r\n    pool.getConnection (\r\n      function(err, connection)\r\n      {\r\n     connection.execute(\" SQL\")\r\n\r\n      });\r\n  });\r\n}\r\n\r\n}\r\n\r\n\r\nright now I do oracledb.createPool for each one of the functions in the module. Is this the correct way to do it? Or should I be doing oracledb.createPool then on success I start the server and then each function(select1, select2) uses pool.getConnection? If so can I just assign my pool connection to a variable and pass it to the functions? \r\n\r\nI am just trying to understand the correct way to use connection pooling. "}}
{"actor":{"display_login":"bmulcahy"}}