{"id":1076,"date":"2020-09-04T20:21:18","date_gmt":"2020-09-04T12:21:18","guid":{"rendered":"http:\/\/123.57.164.21\/?p=1076"},"modified":"2020-09-04T20:22:13","modified_gmt":"2020-09-04T12:22:13","slug":"ibm-cloud-functionsnode-js-%e4%b8%ad-%e5%92%8cdb2%e7%9a%84%e8%bf%9e%e6%8e%a5%e6%96%b9%e6%b3%95","status":"publish","type":"post","link":"https:\/\/92it.top\/?p=1076","title":{"rendered":"IBM Cloud functions(node.js) \b\u4e2d \u548cDB2\u7684\u8fde\u63a5\u65b9\u6cd5"},"content":{"rendered":"\n<p>\u53ef\u4ee5\u5728IBM Cloud Function\u4e2d\u7528\u4e0b\u9762\u7684\u65b9\u6cd5\u8fde\u63a5Cloud DB2<\/p>\n\n\n\n<figure class=\"wp-block-image size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/123.57.164.21\/wp-content\/uploads\/2020\/09\/image-32-1024x474.png\" alt=\"\" class=\"wp-image-1077\" width=\"580\" height=\"267\" srcset=\"https:\/\/92it.top\/wp-content\/uploads\/2020\/09\/image-32-1024x474.png 1024w, https:\/\/92it.top\/wp-content\/uploads\/2020\/09\/image-32-300x139.png 300w, https:\/\/92it.top\/wp-content\/uploads\/2020\/09\/image-32-1536x711.png 1536w, https:\/\/92it.top\/wp-content\/uploads\/2020\/09\/image-32-2048x948.png 2048w, https:\/\/92it.top\/wp-content\/uploads\/2020\/09\/image-32-830x384.png 830w, https:\/\/92it.top\/wp-content\/uploads\/2020\/09\/image-32-230x106.png 230w, https:\/\/92it.top\/wp-content\/uploads\/2020\/09\/image-32-350x162.png 350w, https:\/\/92it.top\/wp-content\/uploads\/2020\/09\/image-32-480x222.png 480w\" sizes=\"(max-width: 580px) 100vw, 580px\" \/><\/figure>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">var ibmdb = require('ibm_db');\nfunction main(params) {\n\nvar ssldsn = 'DATABASE=xxxxx;HOSTNAME=dashdb-txn-flex-yp-xxxxx.xxxxxx.xxxxx.bluemix.net;PORT=xxxxx;PROTOCOL=TCPIP;UID=xxxxx;PWD=xxxxx;Security=SSL;';\nvar sql = 'select * from SYSIBMADM.SNAPDBM';\n\nibmdb.open(ssldsn, function (err,conn) {\n  if (err) return console.log(err);\n\n  conn.query(sql, function (err, data) {\n    if (err) console.log(err);\n    else console.log(data);\n\n    conn.close(function () {\n      console.log('connection closed');\n    });\n  });\n});\n\n\n};<\/pre>\n\n\n\n<p>Mysql\u7684\u4f8b\u5b50\uff1a<em>https:\/\/medium.com\/@taiponrock\/ibm-cloud-functions%E3%81%AE%E5%AE%9F%E8%A3%85%E3%82%92%E5%AD%A6%E3%81%B6-8b2b9b618e16<\/em><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u53ef\u4ee5\u5728IBM Cloud Function\u4e2d\u7528\u4e0b\u9762\u7684\u65b9\u6cd5\u8fde\u63a5Cloud DB2 Mysql\u7684\u4f8b\u5b50\uff1ahttps: [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[16],"tags":[],"_links":{"self":[{"href":"https:\/\/92it.top\/index.php?rest_route=\/wp\/v2\/posts\/1076"}],"collection":[{"href":"https:\/\/92it.top\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/92it.top\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/92it.top\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/92it.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1076"}],"version-history":[{"count":2,"href":"https:\/\/92it.top\/index.php?rest_route=\/wp\/v2\/posts\/1076\/revisions"}],"predecessor-version":[{"id":1079,"href":"https:\/\/92it.top\/index.php?rest_route=\/wp\/v2\/posts\/1076\/revisions\/1079"}],"wp:attachment":[{"href":"https:\/\/92it.top\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1076"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/92it.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1076"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/92it.top\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1076"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}