upvote
Most obviously, Java has JDBC. I think .NET has an equivalent. Drivers are needed but they're often first party, coming directly from the DB vendor itself.

Java also has a JIT compiling JS engine that can be sandboxed and given a VFS:

https://www.graalvm.org/latest/security-guide/sandboxing/

N.B. there's a NodeJS compatible mode, but you can't use VFS+sandboxing and NodeJS compatibility together because the NodeJS mode actually uses the real NodeJS codebase, just swapping out V8. For combining it all together you'd want something like https://elide.dev which reimplemented some of the Node APIs on top of the JVM, so it's sandboxable and virtualizable.

reply
> Most obviously, Java has JDBC. I think .NET has an equivalent. Drivers are needed but they're often first party, coming directly from the DB vendor itself.

So it's an external dependency that is not part of Java. It doesn't really matter if the code comes from the vendor or not. Especially for OpenSource databases.

reply
DBMS vendor providing the client is nice. At least if you're using pg-native in Node, that's just a wrapper around the Postgres-owned libpq, but I've run into small breaking updates before that I don't feel would've happened if Postgres maintained both.
reply
But that’s not Node’s fault surely? Shouldn’t Postgres be providing an NPM module given the popularity of Node?
reply
No it's not Node's fault, this isn't their job. I don't blame Postgres either, cause maintaining libpq is fair enough, just would've been extra nice to have an official Node lib too.
reply
Well in the case of Oracle you can get the language, runtime, DB and driver all from the same organization under unified support contracts.

If you don't value that, why would you want your programming language implementors to also implement database drivers?

reply
Well that's only because Oracle happens to own both Java and Oracle DB. Suppose you're not using that DB.
reply
Bun provides native MySQL, SQlite, and Postgres drivers.

I'm not saying Node should support every db in existence but the ones I listed are critical infrastructure at this point.

When using Postgres in Node you either rely on the old pg which pulls 13 dependencies[1] or postgres[2] which is much better and has zero deps but mostly depends on a single guy.

[1] https://npmgraph.js.org/?q=pg

[2] https://github.com/porsager/postgres

reply
Maybe MySQL and Postgres should make official Node libs then. Bun maintaining this is ok too, but it seems odd given that it means having to keep up with new features in those DBMSes.
reply
> but it seems odd given that it means having to keep up with new features in those DBMSes

That would be more useful for the ecosystem than the Node team investing time on a virtual file system.

reply
Node has sqlite, though I have not had any issues using better-sqlite3 and worker processes for long running ops
reply
Until the day it gets pwned by a malicious actor. Which is something we've seen quite a lot of times on npm deps.
reply
Perl has DBI. PHP has PDO.
reply
Python has DB-API.
reply