Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var oracledb = require('oracledb');
- dbquery = function(user, pass, db, query, callback) {
- oracledb.getConnection({ user : user, password : pass, connectString : db }, function(err, connection) {
- if (err) {
- callback("Couldn't connect to db " + db + " got an error " + err, null);
- }
- connection.execute(query, function(err, result) {
- if (err) {
- callback("Couldn't execute query in db " + db + " got an error " + err, null);
- }
- callback(null, result.rows);
- });
- });
- }
- dbquery("oracledb", "oraclepass", "localhost:1521/oracledbs", "SELECT * FROM Users", function(err, res) {
- if (err) {
- console.log(err);
- } else {
- console.log(res);
- }
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement