Connect to the NuoDB Database

To establish a connection to the NuoDB database from the Node.js application using the NuoDB Node.js driver, there are two options:

  • Direct connection from the driver

  • Connection pool

The decision between utilizing the Connection Pool or a direct connection to the driver depends on the concurrent connection requirements. The connection requirement depends on the number of transactions expected to run simultaneously, which depends on the demand, response time, and available resources.

An application can create, acquire, and use a single connection throughout an application which means all the transactions are executed serially. This approach may not be suitable to process multiple transactions. To process multiple transactions, multiple connections are needed. An application can acquire multiple direct connections from the driver, and these connections can process individual transactions in parallel. However, creating and closing connections for each transaction will cause excessive overhead. Therefore, single connection cannot be used safely to process multiple transactions simultaneously.

To service many transactions over a continuous period of time, use a connection pool. A connection pool reuses connections, minimizing the overhead of having to always incur creation and closing costs.