osdir.com


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Why Python has no equivalent of JDBC of Java?


On Tue, 21 May 2019 at 13:50, Adriaan Renting <renting at astron.nl> wrote:
>
>
> I think it's partially a design philosophy difference.
>
> Java was meant to be generic, run anywhere and abstract and hide
> differences in its underlying infrastructure. This has led to the Java
> VM, and also JDBC I guess.
>
> Python was more of a script interpreted C-derivative, much closer to
> the bare metal, and thus much less effort was made to hide and
> abstract.

In practice, I think it was more to do with the "Pure Java"
philosophy/movement, which resulted in a lot of investment into
reinventing/re-implementing code in Java - in this particular case,
the network protocols that database clients and servers use to
communicate. Because a commercial product like Oracle doesn't document
those protocols, open-source reimplementations are hard, if not
impossible. The Java drivers for Oracle are supplied by Oracle
themselves - Oracle could also provide pure-Python implementations of
the protocols, but they don't - so Python interfaces have to rely on
the libraries Oracle *do* provide.

The same is true of other database interfaces - although in the case
of open source databases it *is* possible to implement the protocol in
pure Python. It's just far less convenient when interfacing to the
existing C libraries is pretty straightforward. For Java interfaces,
linking to "native" libraries is more complex, and generally frowned
on, so there's pressure to implement a "pure Java" solution.

Not having to manage native binaries is a big advantage Java has,
certainly. But conversely, it's meant that building the Java ecosystem
required a massive amount of effort. Luckily, commercial interests
have paid for much of that effort and have made the resulting
libraries freely available. Who knows where we would be if Python had
received a similar level of investment :-)

Paul