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

拥有回忆 提交于 2019-12-25 01:36:00

问题


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?

回答1:


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 c library that's completely specific to postgres. It makes no claim and no attempt to be a generic interface to program against any RDBMS.



来源:https://stackoverflow.com/questions/51312351/is-libpq-more-like-a-jdbc-driver-or-javases-java-sql-package

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!