Unable to retrieve data from table using nodeJS. error: ORA-12560: TNS:protocol adapter error

1k views Asked by At
var oracledb = require('oracledb');

oracledb.getConnection({
    user :  "SYSTEM",
    password :  "*************",
    connectstring : "localhost/XE"
},
function(err, connection)
{
    if(err){
        console.error(err.message);
        return;
    }

    connection.execute(
        "SELECT department_id, department_name "
        + "FROM table1 ",
        function(err, result){
            if(err){
                console.error(err.message);
                doRelease(connection);
                return;
            }
            console.log(result.metadata);
            console.log(result.rows);
            doRealease(connection);
        });
    });
    function doRealease(connection){
        connection.close(
            function(err){
                if(err){
                    console.error(err.message);
                }
            });
    }

This code is showing an error: ORA-12560: TNS:protocol adapter error

I am not sure what the connectstring is and where the problem lies. The terminal shows: [nodemon] clean exit - waiting for changes before restart

1

There are 1 answers

0
Dan McGhan On

You're referencing connectstring. It should be connectString - with a capital S.