2

When writing an application which updates or queries a database, we use something called a database driver (e.g. a JDBC driver). I wonder why it is called a driver instead of a library?

Is libpq a driver too?

Mureinik
  • 297,002
  • 52
  • 306
  • 350

1 Answers1

2

To quote the Wikipedia article you linked to:

In computing, a device driver is a computer program that operates or controls a particular type of device that is attached to a computer.

The analogy here is that a database is an external device that the client computer "controls", by connecting to it and issuing SQL statements against it.

To continue quoting Wikipedia:

In computer science, a library is a collection of non-volatile resources used by computer programs, often for software development.

JDBC drivers are indeed libraries. We refer to them as drivers mostly by force of habit and convention, but it definitely isn't wrong to refer to them as libraries too.

Libpq is indeed a driver too.

Mureinik
  • 297,002
  • 52
  • 306
  • 350
  • Thanks. Appreciated. A related post: https://stackoverflow.com/questions/51312351/is-libpq-more-like-a-jdbc-driver-or-javases-java-sql-package –  Jul 12 '18 at 18:37
  • " a database is an external device". An database can exist even when the database management system isn't running. Do I need to run the database management system process, when running a program based on JDBC? –  Jul 12 '18 at 21:00
  • @Ben There are databases that allow you to embed them within your process (like [tag:sqlite]), but if you're working with a database that has its own process[es] (like [tag:postgresql]), then yes, it(they) must be up and running in order to work against that database. – Mureinik Jul 13 '18 at 06:46
  • Thanks. https://stackoverflow.com/questions/51327962/what-executes-sql-commands-submitted-by-an-application-program-if-no-dbms-is-ru –  Jul 13 '18 at 14:59