Discussions
Categories
- 196.9K All Categories
- 2.2K Data
- 239 Big Data Appliance
- 1.9K Data Science
- 450.3K Databases
- 221.7K General Database Discussions
- 3.8K Java and JavaScript in the Database
- 31 Multilingual Engine
- 550 MySQL Community Space
- 478 NoSQL Database
- 7.9K Oracle Database Express Edition (XE)
- 3K ORDS, SODA & JSON in the Database
- 545 SQLcl
- 4K SQL Developer Data Modeler
- 187K SQL & PL/SQL
- 21.3K SQL Developer
- 295.9K Development
- 17 Developer Projects
- 138 Programming Languages
- 292.6K Development Tools
- 107 DevOps
- 3.1K QA/Testing
- 646K Java
- 28 Java Learning Subscription
- 37K Database Connectivity
- 155 Java Community Process
- 105 Java 25
- 22.1K Java APIs
- 138.1K Java Development Tools
- 165.3K Java EE (Java Enterprise Edition)
- 18 Java Essentials
- 160 Java 8 Questions
- 86K Java Programming
- 80 Java Puzzle Ball
- 65.1K New To Java
- 1.7K Training / Learning / Certification
- 13.8K Java HotSpot Virtual Machine
- 94.3K Java SE
- 13.8K Java Security
- 204 Java User Groups
- 24 JavaScript - Nashorn
- Programs
- 439 LiveLabs
- 38 Workshops
- 10.2K Software
- 6.7K Berkeley DB Family
- 3.5K JHeadstart
- 5.7K Other Languages
- 2.3K Chinese
- 171 Deutsche Oracle Community
- 1.1K Español
- 1.9K Japanese
- 232 Portuguese
Node-oracledb 0.4.2 is now on NPM

The 0.4.2 version of the Oracle Database driver for Node.js is now out at: https://github.com/oracle/node-oracledb
It's now officially on the NPM registry too https://www.npmjs.com/package/oracledb
The change summary is at: https://blogs.oracle.com/opal/entry/node_oracledb_0_4_2
Answers
-
Hi,
Exciting and interesting as it seems I find it difficult to understand the usability/practicality of allowing direct connections to database from client application via JS.
I guess one of the reasons middle-tier exists is to make database transaction and connection handling modular and shield databases from any potential threats.
Is it possible to give some use case examples where javascript connectivity would be useful for enterprise level applications having large user base?
Thanks,
Shishir
-
Node.js is a mid-tier. It extends JavaScript. The node-oracledb driver lets you access Oracle Database from the Node.js mid-tier just like you would use JDBC from Java, OCI8 from PHP, or cx_Oracle from Python etc. Applications can make use of the growing Node.js ecosystem and JavaScript libraries for a wide variety of purposes.
-
Hi cj - Thanks for your reply.
Looking at the example connection the db authentication parameters are being exposed in the client side script. Is that intentional or there are ways to encrypt the parameter ?
Also is the node.js mid-tier handling the connection pooling and recycling of db connections implicitly or the developers have to manage those aspects in their code (e.g. max connections, timeout etc) ?
Thanks,
S
-
The node-oracledb doc answers these questions: https://github.com/oracle/node-oracledb/blob/master/doc/api.md
You can use external authentication. There is both connection (i.e OCI session) pooling in node-oracledb process, and Database Resident Connection Pooling. These are configurable.
-
This is great. I have a question though, on windows 64 bits, where should the module be installed?
I ended up with these things generated:
C:\node-oracledb\node_modules\oracledb\build\Release
obj (directory)
oracledb.exp
oracledb.lib
oracledb.node
oracledb.pdb
When I try to run a program like select1.js I get:
Cannot find module 'oracledb'
What has to go where in order for it to find the module? I notice that there is a module under the node directory:
C:\Program Files\nodejs\node_modules
which contains npm currently. Is that where oracledb.node should go? So far I'm not getting that to work. This being windows it's
better to not keep adding things to the path as there is a limit to the size of it.
-
BTW this is not working either:
npm install oracledb -g
which put this in the path:
C:\Users\Administrator\AppData\Roaming\npm
under which is :
node_modules\oracledb\(etc stuff)
And the bottom line is, it's still not finding the module:
Error: Cannot find module 'oracledb'
-
This doesn't work either finding oracledb.js and putting it in the path. I guess I'll be shelving this idea for a while.
-
Ok I found out one way that you can get node to find the module based on this info:
Where Does Node.js And Require() Look For Modules?
Suppose you compiled your module from this directory:
node-oracledb
which resulted in node_modules under that directory. Then have it that your example code is in node-oracledb so that the
node_modules are under that directory. Seems to work!