Search code examples
postgresqljdbclibpq

Is libpq more like a JDBC driver or JavaSE's java.sql package?


Is it correct that the following two are different concepts:

  • a JDBC driver (e.g. a JDBC driver for PostgreSQL) and
  • JavaSE's java.sql package?

Is it correct that the JavaSE's java.sql package is an API built upon a JDBC driver, to become driver-agnostic?

In C for PostgreSQL,

  • what is the equivalence to a JDBC driver, and
  • what is the equivalence to java.sql?
  • Is libpq more like a JDBC driver for PostgreSQL or JavaSE's java.sql package?

Solution

  • Java SE' java.sql package defines interfaces that Java libraries called JDBC drivers can implement to provide the functionality of working with a database in a way that's [almost] vendor agnostic. With JDBC (the java.sql package), you [almost] never use vendor-specific classes, and just program against the interfaces.

    libpq is something completely different - it's a library that's completely specific to . It makes no claim and no attempt to be a generic interface to program against any RDBMS.