title: Connecting to a remote Oracle DB with Nodejs through Oracledb Driver
body: <p>Hey I'm really trying to figure out how to connect to a remote Oracle test DB and I have no experience in Java. So if I could get your help, I would be forever grateful. </p>
  
  <p>I have a remote test database I'm trying to connect to and I have a jdbc connection with an old style SID. According to this link: <a href="https://github.com/oracle/node-oracledb/blob/master/doc/api.md#notjdbc" rel="nofollow noreferrer">https://github.com/oracle/node-oracledb/blob/master/doc/api.md#notjdbc</a>, I'm supposed to create a tnsnames.ora file to put the connection in, like so: </p>
  
  <p>tnsnames.ora:</p>
  
  <pre><code>appDB =
   (DESCRIPTION =
     (ADDRESS = (PROTOCOL = TCP)(HOST = hostname)(PORT = 1521))
     (CONNECT_DATA =
       (SID = ORCL)
     )
   )
  </code></pre>
  
  <p>and then I'm supposed to reference it in my node server.js file, like so</p>
  
  <p>server.js:</p>
  
  <pre><code>const oracledb = require('oracledb');
  oracledb.getConnection(
    {
      user          : process.env.ORACLE_USER,
      password      : process.env.ORACLE_PASSWORD,
      connectString : "appDB"
    },
    function(err, connection)
    {
      if (err) {
        console.error(err.message);
        return;
      }
      connection.execute(
        "SELECT * " +
          "FROM BOS_course",
        function(err, result)
        {
          if (err) {
            console.error(err.message);
            doRelease(connection);
            return;
          }
          console.log(result.rows);
          doRelease(connection);
        });
    });
  
  module.exports = {
      oracledb
  };
  </code></pre>
  
  <p>However, I have no idea where I'm supposed to put the tnsnames.ora file. I found this link online <code>$ORACLE_HOME/network/admin</code> but I don't know what it's referring to. I only have limited access to the database. Excuse my Java ignorance. How can I use this connection in my node app, which lives completely separate from the database? How does my app know what "appDB" is and how to find it in the tnsnames.ora file?</p>
  
  <p>Thanks in advance!</p>