Oracle Magazine, September/October 2017
Database Developer OPEN SOURCE the drivers relatively young age its quite feature rich and performant The node oracledb driver exposes several classes for doing various operations from executing SQL and PL SQL to streaming large result sets and large objects LOBs Youll use two of those classes Oracledb and Connection to execute a simple query Oracledb the base class will be used to obtain a connection to the database which will return an instance of the Connection class The connection will be used to execute the query Heres an example of using node oracledb to execute a query on the employees table in the HR schema The dbConfig code should work for the App Dev VM described in Creating a Sandbox for Learning Node js and Oracle Database but it will need to be modified for other environments ORACLE MAGAZINE SEPTEMBER OCTOBER 2017 49 const oracledb require oracledb const dbConfig user hr password oracle connectString localhost 1521 orcl oracledb getConnection dbConfig function err conn if err console log Error getting connection err return console log Connected to database
You must have JavaScript enabled to view digital editions.