Database Drivers at a Glance: One Card per Language

This page is a text-first infographic. Each block below is a "card" you could draw on a poster, with a short caption describing the picture. It summarises what a database driver is and which drivers beginners commonly meet in popular languages.

Card 1: what a driver is

Picture: your app on the left, the database on the right, and a small translator in the middle.

Caption: a driver is a library that lets your programming language talk to a particular database. Your code calls the driver; the driver speaks the database's network language (its "protocol") and brings results back as values your code understands.

Card 2: the five steps every driver follows

  1. Connect using a host, port, database name and login, or a file path for SQLite.
  2. Send a SQL statement, ideally with placeholders for values.
  3. Receive rows back.
  4. Convert each value into a type your language knows, such as numbers, text and dates.
  5. Close the connection, or return it to a pool for reuse.

Caption: whatever the language, the shape is the same. Learn it once and every driver feels familiar.

Card 3: Python

Picture: a Python logo beside three small boxes.

Commonly used drivers: sqlite3 (built into Python), psycopg for PostgreSQL, and several MySQL drivers such as mysql-connector-python and PyMySQL. Most follow a shared Python standard called the DB-API (PEP 249), so the code looks alike.

Card 4: JavaScript and Node.js

Commonly used drivers: pg (often called node-postgres) for PostgreSQL, mysql2 for MySQL, and better-sqlite3 or sqlite3 for SQLite.

Caption: most Node.js drivers are asynchronous: you await a query instead of waiting for it in a straight line.

Card 5: Java

Commonly used drivers: JDBC drivers, such as the PostgreSQL JDBC driver and MySQL Connector/J. JDBC is Java's standard way of talking to databases, so switching databases mostly means switching the driver and the URL.

Card 6: C# and .NET

Commonly used drivers: Microsoft.Data.SqlClient for SQL Server, Npgsql for PostgreSQL, MySqlConnector for MySQL, and Microsoft.Data.Sqlite for SQLite. They follow the ADO.NET pattern of connection, command and reader.

Card 7: PHP

Common choice: PDO (PHP Data Objects), a built-in layer with drivers for many databases. It supports prepared statements with placeholders.

Card 8: the safety rule on every card

Picture: a padlock.

Caption: every driver above supports placeholders. Always pass user values through them, never by gluing text into SQL.

The whole poster in one table

LanguageSQLitePostgreSQLMySQL
Pythonsqlite3psycopgmysql-connector-python, PyMySQL
Node.jsbetter-sqlite3, sqlite3pgmysql2
JavaSQLite JDBC driverPostgreSQL JDBCConnector/J
C#Microsoft.Data.SqliteNpgsqlMySqlConnector
PHPPDOPDOPDO

Library names and popularity change over time, so check each project's own page for the current recommended driver. For the full story, read An Essay on Database Drivers.

A free learning page for beginners. Practise on a test database, never on real customer data, and check the official documentation for your database version.