{"id":990,"date":"2015-09-14T17:57:28","date_gmt":"2015-09-14T08:57:28","guid":{"rendered":"http:\/\/blog.moramcnt.com\/?p=990"},"modified":"2015-09-15T13:33:10","modified_gmt":"2015-09-15T04:33:10","slug":"nodejs-%ec%98%a4%eb%9d%bc%ed%81%b4%ec%97%b0%eb%8f%99-node-oracledb-%ec%84%a4%ec%b9%98","status":"publish","type":"post","link":"http:\/\/blog.moramcnt.com\/?p=990","title":{"rendered":"nodejs \uc624\ub77c\ud074\uc5f0\ub3d9 node-oracledb \uc124\uce58"},"content":{"rendered":"<p>1. NodeJS \uc124\uce58<br \/>\n\t\uae30\uc900)NodeJS Version 0.12.0-x64<br \/>\n\thttps:\/\/nodejs.org\/en\/download\/ \uc5d0\uc11c 64 \ube44\ud2b8\uc6a9 \ubc84\uc804 0.12.0- 64bit<br \/>\n\t\uc8fc\uc758) \ubc84\uc804\uc758 \ub9de\ucda4\uc774 \uc911\uc694 (\ucd5c\uc2e0\ubc84\uc804 4.0 \uae30\uc900\uc73c\ub85c \uc124\uce58\uac00 \uc798 \uc548\ub428)<\/p>\n<p>2. \uc624\ub77c\ud074\uc6a9 \uc778\uc2a4\ud134\uc2a4 DLL, SDK \uc124\uce58<br \/>\n\t\uae30\uc900) \uc624\ub77c\ud074 12.1.0.2 64bit\uc6a9<br \/>\n\tinstantclient_basic-windows.x64-12.1.0.2.0.zip<br \/>\n\tinstantclient_sdk-windows.x64-12.1.0.2.0.zip<\/p>\n<p>\t2.1 \ubc84\uc804\uc5d0 \ub9de\ub294 \uc2e4\ud589\uac00\ub2a5 DLL, SDK \uac01 2\uac1c\uc758 \uc555\ucd95\ud30c\uc77c\uc744 \ub2e4\uc6b4\ub85c\ub4dc<br \/>\n\t\t\ub2e4\uc6b4\ub85c\ub4dc \ubc1b\uc740 \ud30c\uc77c\uc744 \uac19\uc740 \ud3f4\ub354\uc5d0 \uc555\ucd95\ud574\uc81c<br \/>\n\t\tex) C:\\oracle\\instantclient<br \/>\n\t2.2 \uc555\ucd95\ud574\uc81c \ud55c \ub514\ub809\ud1a0\ub9ac\uc5d0 \uc708\ub3c4\uc6b0\uc988 \ud658\uacbd\ubcc0\uc218\uc5d0 PATH \uc124\uc815<br \/>\n\t\t\uc81c\uc5b4\ud310 -> \uc2dc\uc2a4\ud15c \ubc0f \ubcf4\uc548->\uc2dc\uc2a4\ud15c->\uace0\uae09\uc2dc\uc2a4\ud15c\uc124\uc815->\ud658\uacbd\ubcc0\uc218 PATH\uc5d0 \ucd94\uac00<\/p>\n<p>3. \ud30c\uc774\uc120 \uc124\uce58<br \/>\n\t\uae30\uc900) Python 2.7.10 MSI 64Bit<br \/>\n\t&#8211; Download Windows x86-64 MSI installer \ub97c \ub2e4\uc6b4\ubc1b\uc544\uc11c \uc124\uce58<br \/>\n        &#8211; \uc124\uce58\ub41c\uacf3\uc744 \ud658\uacbd\ubcc0\uc218 PATH\uc5d0 \ub4f1\ub85d<\/p>\n<p>4. \ube44\uc8fc\uc5bc \uc2a4\ud29c\ub514\uc624 \uac1c\ubc1c \ucee4\uba58\ub4dc\ucc3d\uc5d0 \ud658\uacbd\ubcc0\uc218 \uc124\uc815<br \/>\n\t\uae30\uc900) Visual Studion 2013<br \/>\n\t2.1 \ub3c4\uc2a4\ucc3d\uc5d0\uc11c C:\\Program Files (x86)\\Microsoft Visual Studio 12.0\\VC\\vcvarsall.bat \uc2e4\ud589<br \/>\n\t2.2 \ub3c4\uc2a4\ucc3d\uc5d0\uc11c \uac01 set \uc124\uc815\uc744 \uc2e4\ud589<br \/>\n\t\tset OCI_LIB_DIR=C:\\oracle\\instantclient_12_1\\sdk\\lib\\msvc<br \/>\n\t\tset OCI_INC_DIR=C:\\oracle\\instantclient_12_1\\sdk\\include<\/p>\n<p>5. NodeJS \uc758 npm\uc744 \uc774\uc6a9\ud558\uc5ec node-oracledb\ub97c \uc124\uce58<br \/>\n\tnpm install oracledb<\/p>\n<p>6. \uc124\uce58\ud14c\uc2a4\ud2b8<br \/>\n\tnode  test.js<\/p>\n<pre class=\"lang:js decode:true \" title=\"dbconfig.js\" >\r\nmodule.exports = {\r\n  user          : process.env.NODE_ORACLEDB_USER || \"db\uc544\uc774\ub514\",\r\n  password      : process.env.NODE_ORACLEDB_PASSWORD || \"db\ud328\uc2a4\uc6cc\ub4dc\",\r\n  connectString : process.env.NODE_ORACLEDB_CONNECTIONSTRING || \"db\uc544\uc774\ud53c\/dbSID\",\r\n  externalAuth  : process.env.NODE_ORACLEDB_EXTERNALAUTH ? true : false\r\n};<\/pre>\n<pre class=\"lang:js decode:true \" title=\"test.js\" >\r\nvar oracledb = require('oracledb');\r\nvar dbConfig = require('.\/dbconfig.js');\r\n\r\noracledb.getConnection(\r\n  {\r\n    user          : dbConfig.user,\r\n    password      : dbConfig.password,\r\n    connectString : dbConfig.connectString\r\n  },\r\n  function(err, connection)\r\n  {\r\n    if (err) {\r\n      console.error(err.message);\r\n      return;\r\n    }\r\n    connection.execute(      \r\n\t\"select issue_yymm, epc_code, remark, tag_location_seq,  reg_date from tag_issue WHERE rownum < :did\",\r\n      [50],\r\n      function(err, result)\r\n      {\r\n        if (err) {\r\n          console.error(err.message);\r\n          doRelease(connection);\r\n          return;\r\n        }\r\n        console.log(result.metaData);\r\n        console.log(result.rows);\r\n        doRelease(connection);\r\n      });\r\n  });\r\n\r\nfunction doRelease(connection)\r\n{\r\n  connection.release(\r\n    function(err) {\r\n      if (err) {\r\n        console.error(err.message);\r\n      }\r\n    });\r\n}<\/pre>\n<p>\ucc38\uace0\uc2f8\uc774\ud2b8<\/p>\n<p>--NodeJS Home<br \/>\nhttps:\/\/nodejs.org<\/p>\n<p>--\ud30c\uc774\uc120 Home<br \/>\nhttps:\/\/www.python.org\/<\/p>\n<p>-- \uc624\ub77c\ud074 Instant Client Downloads<br \/>\nhttp:\/\/www.oracle.com\/technetwork\/database\/features\/instant-client\/index-097480.html<\/p>\n<p>-- \uc624\ub77c\ud074 NodeJs \ub514\ubca8\ub85c\ud37c \uc13c\ud130<br \/>\nhttp:\/\/www.oracle.com\/technetwork\/database\/database-technologies\/node_js\/oracle-node-js-2399407.html<\/p>\n<p>--  \uc624\ub77c\ud074 npm oracledb \ud648<br \/>\nhttps:\/\/www.npmjs.com\/package\/oracledb<\/p>\n<p>-- node-oracledb \uc608\uc81c<br \/>\nhttps:\/\/github.com\/oracle\/node-oracledb\/tree\/master\/examples<\/p>\n","protected":false},"excerpt":{"rendered":"<p>1. NodeJS \uc124\uce58 \uae30\uc900)NodeJS Version 0.12.0-x64 https:\/\/nodejs.org\/en\/download\/ \uc5d0\uc11c 64 \ube44\ud2b8\uc6a9 \ubc84\uc804 0.12.0- 64bit \uc8fc\uc758) \ubc84\uc804\uc758 \ub9de\ucda4\uc774 \uc911\uc694 (\ucd5c\uc2e0\ubc84\uc804 4.0 \uae30\uc900\uc73c\ub85c \uc124\uce58\uac00 \uc798 \uc548\ub428) 2. \uc624\ub77c\ud074\uc6a9 \uc778\uc2a4\ud134\uc2a4 DLL, SDK \uc124\uce58 \uae30\uc900) \uc624\ub77c\ud074 12.1.0.2 64bit\uc6a9 instantclient_basic-windows.x64-12.1.0.2.0.zip instantclient_sdk-windows.x64-12.1.0.2.0.zip 2.1 \ubc84\uc804\uc5d0 \ub9de\ub294 \uc2e4\ud589\uac00\ub2a5 DLL, SDK \uac01 2\uac1c\uc758 \uc555\ucd95\ud30c\uc77c\uc744 \ub2e4\uc6b4\ub85c\ub4dc \ub2e4\uc6b4\ub85c\ub4dc \ubc1b\uc740 \ud30c\uc77c\uc744 \uac19\uc740 \ud3f4\ub354\uc5d0 \uc555\ucd95\ud574\uc81c ex) C:\\oracle\\instantclient 2.2 \uc555\ucd95\ud574\uc81c [&hellip;]<\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"_uf_show_specific_survey":0,"_uf_disable_surveys":false,"footnotes":""},"categories":[46,4],"tags":[],"class_list":["post-990","post","type-post","status-publish","format-standard","hentry","category-node-js","category-4"],"_links":{"self":[{"href":"http:\/\/blog.moramcnt.com\/index.php?rest_route=\/wp\/v2\/posts\/990","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/blog.moramcnt.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/blog.moramcnt.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/blog.moramcnt.com\/index.php?rest_route=\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"http:\/\/blog.moramcnt.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=990"}],"version-history":[{"count":5,"href":"http:\/\/blog.moramcnt.com\/index.php?rest_route=\/wp\/v2\/posts\/990\/revisions"}],"predecessor-version":[{"id":995,"href":"http:\/\/blog.moramcnt.com\/index.php?rest_route=\/wp\/v2\/posts\/990\/revisions\/995"}],"wp:attachment":[{"href":"http:\/\/blog.moramcnt.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=990"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/blog.moramcnt.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=990"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/blog.moramcnt.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=990"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}