Search code examples
jdbcnaminglibpqdatabase-drivendatabase-programming

Why is programming interface to database called driver?


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?


Solution

  • 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.