If you are looking to connect to your databases like SQL Server, Oracle, DB2, Postgres, MongoDB etc., or SaaS apps like Salesforce, Eloqua, Oracle Sales Cloud, Oracle Service Cloud etc., using a ODBC driver from your Node.js application, this is the place to get started. In this tutorial, we will walk you through on how you can connect to Oracle database from Node.js using Progress DataDirect ODBC drivers.
Have Node.js installed on your machine
npm i odbc
var db
=
require(
'odbc'
)()
, cn
=
"Dsn=Oracle;UID=saikrishnabobba;PWD=<password>;"
/
/
open the connection
db.open(cn, function (err) {
if
(err) {
return
console.log(err);
}
/
/
Run a sample query
db.query(
"select * from COUNTRIES"
, function (err, rows, moreResultSets) {
if
(err) {
return
console.log(err);
}
console.log(rows);
});
});
You can use similar steps with any of DataDirect ODBC suite of drivers available for Relational, Big Data, SaaS and NoSQL Data sources. Feel free to try any of our drivers with your Node.js apps for connecting to your datasource of your choice.