Question

I'm pretty new to node, and I was wondering if there's any standard, open, API that could abstract me away from all the different database idiosyncrasies.

Any link with tutorials or documentation would be pretty much welcome indeed.

No correct solution

OTHER TIPS

There's not a "standard" db abstraction layer for Node, but take a look at Node-DBI which is open-source and maintained on GitHub. There are probably others but this one has a good interface and several adapters already.

I think node-jdbc is a comprehensive module which is frequently being updated. Its documents are accessible on github as well.

There are none that I know of, and looking at the official node documentation doesn't list anything of the sort, which is disappointing.

If you're not opposed to using an ORM then Sequelize is a pretty good option, it only handles a subset of SQL, but it . This Project looks like an effort to do what you described; however, that project looks like it was last updated a long while ago.

Not exactly, but the Loopback Framework for Node.js has ORM-like data source connectors that allow you to connect to many data sources through a common syntax. It's a full enterprise-grade framework, so has a lot of other components as well. Other frameworks like Sails.js have similar components.

Sequelize is a great ORM for PostgreSQL, MySQL, SQLite and MSSQL.

TypeORM is also great and supports MySQL, PostgreSQL, MariaDB, SQLite, MS SQL Server, Oracle, SAP Hana, WebSQL databases. Works in NodeJS, Browser, Ionic, Cordova and Electron platforms.

Although not exactly like JDBC or JPA, knex seems to be a good SQL abstraction on top of several databases.

Knex.js is a "batteries included" SQL query builder for Postgres, MSSQL, MySQL, > MariaDB, SQLite3, Oracle, and Amazon Redshift designed to be flexible, portable, > and fun to use.

I haven't really used it, but given the desolate landscape it seems like a good option.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top