Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What's the equivalent of JPA or JDBC for node?

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.

like image 963
opensas Avatar asked Jan 25 '13 01:01

opensas


4 Answers

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.

like image 115
sstur Avatar answered Oct 02 '22 10:10

sstur


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

like image 24
Majid Yaghouti Avatar answered Oct 02 '22 10:10

Majid Yaghouti


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.

like image 31
Andrew Avatar answered Oct 02 '22 09:10

Andrew


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.

like image 33
Jonathan Avatar answered Oct 02 '22 09:10

Jonathan