Syntax to use node Oracle

hello,
Can you explain or show me how to use, (the right syntax), the node oracle db.
The connection to the base it's ok, but i can't write or retrieve nothing.
thanks
Nico

This doesn't tell us very much! Usually with db nodes you have to set the topic as the query. Show us your complete flow.

The documentation for that node is woefully innadequate. You could try it with the query in the topic as @ghayne suggests as some other db nodes do that. Try putting a simple select query in the topic and see what happens.

Hello Guys,
Thanks for answers, i work on this yesterday , and i find a way to realise a small basic crud.
It's very basic but to be usefull to someone, I use jsgrid.


!
my flow:

[{"id":"420365db.602b7c","type":"oracledb","z":"aaaead6e.8c7b5","name":"","usequery":false,"query":"INSERT INTO A\n\tVALUES (\n\t:v1,\n\t:v2,\n\t:v3\n\t)","usemappings":false,"mappings":"[\n\t\"location.of.first.array.index.field.in.msg.payload\",\n\t\"location.of.second.array.index.field\",\n\t\"last_array_indexfield.in[3]\"\n]","server":"ad948324.32452","resultaction":"single","resultlimit":100,"x":2360,"y":1240,"wires":[["80838837.a870f8"]]},{"id":"fc6f0ba2.b22b18","type":"function","z":"aaaead6e.8c7b5","name":"delete","func":"msg.payload=[msg.req.body.ID];\n\n\nreturn msg;","outputs":1,"noerr":0,"x":2210,"y":1300,"wires":[["aa663cd6.c82e9"]]},{"id":"aa663cd6.c82e9","type":"oracledb","z":"aaaead6e.8c7b5","name":"","usequery":false,"query":"DELETE FROM A WHERE ID=:v1\n\t","usemappings":false,"mappings":"[\n\t\"location.of.first.array.index.field.in.msg.payload\",\n\t\"location.of.second.array.index.field\",\n\t\"last_array_indexfield.in[3]\"\n]","server":"ad948324.32452","resultaction":"single","resultlimit":100,"x":2360,"y":1300,"wires":[["3c303614.b23f5a"]]},{"id":"a5ca143a.1ead68","type":"function","z":"aaaead6e.8c7b5","name":"update","func":"msg.payload=[msg.req.body.NAME,msg.req.body.TEL, msg.req.body.ID];\n \n\nreturn msg;","outputs":1,"noerr":0,"x":2220,"y":1420,"wires":[["879b254e.937388"]]},{"id":"879b254e.937388","type":"oracledb","z":"aaaead6e.8c7b5","name":"","usequery":false,"query":"UPDATE A SET NAME = :v1 , TEL =: v2 where ID = :v3\n\t","usemappings":false,"mappings":"[\n\t\"location.of.first.array.index.field.in.msg.payload\",\n\t\"location.of.second.array.index.field\",\n\t\"last_array_indexfield.in[3]\"\n]","server":"ad948324.32452","resultaction":"single","resultlimit":100,"x":2360,"y":1420,"wires":[["76980b94.e13f84"]]},{"id":"9826d5de.4a6418","type":"oracledb","z":"aaaead6e.8c7b5","name":"","usequery":false,"query":"select * from A\n","usemappings":false,"mappings":"[\n\t\"location.of.first.array.index.field.in.msg.payload\",\n\t\"location.of.second.array.index.field\",\n\t\"last_array_indexfield.in[3]\"\n]","server":"ad948324.32452","resultaction":"multi","resultlimit":100,"x":2360,"y":1160,"wires":[["de8147c0.b1df08"]]},{"id":"4dfa72a.2f7f78c","type":"function","z":"aaaead6e.8c7b5","name":"find","func":"msg.payload=[];\n\n\nreturn msg;","outputs":1,"noerr":0,"x":2210,"y":1160,"wires":[["9826d5de.4a6418"]]},{"id":"7a3b10.654684f","type":"http in","z":"aaaead6e.8c7b5","name":"","url":"/app_oracle","method":"get","upload":false,"swaggerDoc":"","x":1920,"y":1160,"wires":[["4dfa72a.2f7f78c"]]},{"id":"782f3a0a.887204","type":"http in","z":"aaaead6e.8c7b5","name":"","url":"/delete_oracle","method":"delete","upload":false,"swaggerDoc":"","x":1920,"y":1300,"wires":[["f38c7958.549298"]]},{"id":"1e9e66ce.781989","type":"http in","z":"aaaead6e.8c7b5","name":"","url":"/insert_oracle","method":"post","upload":false,"swaggerDoc":"","x":1910,"y":1240,"wires":[["fedd1644.2083d8"]]},{"id":"7b828e3a.ec40b","type":"http in","z":"aaaead6e.8c7b5","name":"","url":"/update_oracle","method":"put","upload":false,"swaggerDoc":"","x":1930,"y":1420,"wires":[["67bc95cd.daf95c"]]},{"id":"f48ff506.b01aa8","type":"http response","z":"aaaead6e.8c7b5","name":"","statusCode":"","headers":{},"x":3030,"y":1160,"wires":[]},{"id":"2fc29a4a.7d0636","type":"http response","z":"aaaead6e.8c7b5","name":"","x":3030,"y":1420,"wires":[]},{"id":"df371809.14feb8","type":"http response","z":"aaaead6e.8c7b5","name":"","x":3030,"y":1300,"wires":[]},{"id":"b81d2492.19a008","type":"http response","z":"aaaead6e.8c7b5","name":"","x":3030,"y":1240,"wires":[]},{"id":"3c303614.b23f5a","type":"function","z":"aaaead6e.8c7b5","name":"update-response","func":"msg.payload=msg.result;\nreturn msg;","outputs":1,"noerr":0,"x":2670,"y":1300,"wires":[["df371809.14feb8"]]},{"id":"80838837.a870f8","type":"function","z":"aaaead6e.8c7b5","name":"insert-response","func":"msg.payload=msg.result;\nreturn msg;","outputs":1,"noerr":0,"x":2660,"y":1240,"wires":[["b81d2492.19a008"]]},{"id":"76980b94.e13f84","type":"function","z":"aaaead6e.8c7b5","name":"delete-response","func":"msg.payload=msg.result;\nreturn msg;","outputs":1,"noerr":0,"x":2660,"y":1420,"wires":[["2fc29a4a.7d0636"]]},{"id":"de8147c0.b1df08","type":"json","z":"aaaead6e.8c7b5","name":"","property":"payload","action":"","pretty":false,"x":2610,"y":1160,"wires":[["a7f4bc9.4a09d4"]]},{"id":"a7f4bc9.4a09d4","type":"template","z":"aaaead6e.8c7b5","name":"Web Template","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"\n\n\n\n<!DOCTYPE html>\n<html lang=\"fr\">\n<head>\n    <title>Base de donnée</title>\n    <meta charset=\"utf-8\">\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\n    <link rel=\"stylesheet\" href=\"https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css\">\n    <link rel=\"stylesheet\" href=\"https://cdnjs.cloudflare.com/ajax/libs/bootstrap-timepicker/0.5.2/css/bootstrap-timepicker.min.css\" />\n    <script src=\"https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js\"></script>\n    <script src=\"https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.js\"></script>\n    <script src=\"https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js\"></script>\n    <link type=\"text/css\" rel=\"stylesheet\" href=\"https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.css\" />\n    <link type=\"text/css\" rel=\"stylesheet\" href=\"https://cdnjs.cloudflare.com/ajax/libs/jsgrid/1.5.3/jsgrid.min.css\" />\n    <link type=\"text/css\" rel=\"stylesheet\" href=\"https://cdnjs.cloudflare.com/ajax/libs/jsgrid/1.5.3/jsgrid-theme.min.css\" />\n    <script type=\"text/javascript\" src=\"https://cdnjs.cloudflare.com/ajax/libs/jsgrid/1.5.3/jsgrid.min.js\"></script>\n    \n     <style>\n         body {\n  font-family: \"serif\";\n  font-size: 1.4em;\n}\n\n.controls {\n  margin: 10px;\n}\n\n.summary {\n  font-weight: bold;\n}\n\n/* header row */\n.jsgrid-header-row>.jsgrid-header-cell {\n  background-color: #5cb85c;      /* success */\n  font-family: \"serif \";\n  font-size: 1.4em;\n  color: white;\n  font-weight: normal;\n}\n\n/* rows */\n.jsgrid-row>.jsgrid-cell {\n  background-color: white;\n}\n\n/* alternate rows */\n.jsgrid-alt-row>.jsgrid-cell {\n  background-color: #F0F0F0;\n}\n\n/* editing row */\n.jsgrid-edit-row>.jsgrid-cell {\n  background-color: #5cb85c;\n}\n\n\n  \n     </style>\n  \n <body>    \n     <div class = \"flex\">\n    \n         <div id=\"jsGrid\" ></div>\n \n\n         <script type=\"text/javascript\">\n    \n\n\n             var db = {\n                 loadData: function(filter) {\n                 return $.grep(this.clients, function(client) {\n                   return  (!filter.ID   || client.ID === filter.ID)\n                     && (!filter.NAME || client.NAME.indexOf(filter.NAME) > -1) \n                     &&(!filter.TEL   || client.TEL === filter.TEL);\n             \n                  });\n                 },\n                       \n                                         insertItem: function(item) {\n                                            return $.ajax({\n                                                type: \"POST\",\n                                                url: \"/insert_oracle\",\n                                                data: item\n                                            });\n                                        },\n                                        updateItem: function(item) {\n                                           return $.ajax({\n                                                type: \"PUT\",\n                                                url: \"/update_oracle\",\n                                                data: item\n                                            });\n                                        },\n                                        deleteItem: function(item) {\n                                            return $.ajax({\n                                                type: \"DELETE\",\n                                                url: \"/delete_oracle\",\n                                                data: item\n                                            });\n                                            },\n        }\n\n                 \n                     window.db = db;\n                     db.clients = {{#payload}}{{{.}}}{{/payload}};  \n                 $(\"#jsGrid\").jsGrid({\n                  height: \"auto\",\n                  width: \"100%\",\n                  inserting:true,\n                  filtering: true,\n                  editing: true,\n                  sorting: true,\n                  paging: true,\n                  autoload: true,\n                \n                  pageSize: 15,\n                  pageButtonCount: 5,\n                \n                  deleteConfirm: \"Es tu certain de vouloir supprimer ce document?\",\n                \n                  controller: db,\n                 \n                      \n                \n                  fields: [\n                      {\n                    type: \"control\",\n                    width:20\n                     },\n                      { name: \"NAME\", \n                        type: \"text\", \n                        width: 40, \n                        align: \"center\" },\n                       {\n                        name:\"TEL\",\n                        type: \"number\",\n                        width:20\n                        \n                    },\n                    {\n                        name:\"ID\",\n                        type: \"number\",\n                        width:20\n                        \n                    }\n                     \n                  ]\n                  \n                  \n                 });\n                  \n    \n\n\n\n            </script>\n\n\n\n        </div>\n\n\n    </body>\n\n    </head>\n</html>\n\n","x":2820,"y":1160,"wires":[["f48ff506.b01aa8"]]},{"id":"fedd1644.2083d8","type":"function","z":"aaaead6e.8c7b5","name":"Parser","func":"if (msg.payload.hasOwnProperty('TEL')) {\n\n   msg.payload.TEL = parseInt(msg.payload.TEL)\n\n}\nif (msg.payload.hasOwnProperty('ID')) {\n\n   msg.payload.ID = parseInt(msg.payload.ID)\n\n}\n\nreturn msg;\n","outputs":1,"noerr":0,"x":2090,"y":1240,"wires":[["1aefc8e6.e6e227"]]},{"id":"1aefc8e6.e6e227","type":"function","z":"aaaead6e.8c7b5","name":"insert","func":"msg.payload=[msg.req.body.NAME,\n                msg.req.body.TEL,\n                msg.req.body.ID];\n\nreturn msg;","outputs":1,"noerr":0,"x":2210,"y":1240,"wires":[["420365db.602b7c"]]},{"id":"f38c7958.549298","type":"function","z":"aaaead6e.8c7b5","name":"Parser","func":"\nif (msg.payload.hasOwnProperty('ID')) {\n\n   msg.payload.ID = parseInt(msg.payload.ID)\n\n}\n\nreturn msg;\n","outputs":1,"noerr":0,"x":2090,"y":1300,"wires":[["fc6f0ba2.b22b18"]]},{"id":"67bc95cd.daf95c","type":"function","z":"aaaead6e.8c7b5","name":"Parser","func":"if (msg.payload.hasOwnProperty('TEL')) {\n\n   msg.payload.TEL = parseInt(msg.payload.TEL)\n\n}\nif (msg.payload.hasOwnProperty('ID')) {\n\n   msg.payload.ID = parseInt(msg.payload.ID)\n\n}\n\nreturn msg;\n","outputs":1,"noerr":0,"x":2090,"y":1420,"wires":[["a5ca143a.1ead68"]]},{"id":"ad948324.32452","type":"oracle-server","z":"","host":"localhost","port":"1521","reconnect":true,"reconnecttimeout":"5000","db":"xepdb1"}]

next step i'm try to use vuejs instead jsgrid......

see you
Nico

1 Like