Home / Learn Secure SQL / The Client-Server Model for Databases

The Client-Server Model for Databases

App, driver, network, and database engine as four separate things.

The gistApp, driver, network, and database engine as four separate things.

The idea, explained simply

Four boxesyour application codedatabase driverlibrarynetwork connection(often TLS)database server
Four boxes

In plain terms

Your application and your database are almost always two separate programs, often on two separate machines, talking over a connection.

Why we use it

Security controls live at different points in this chain: some in your code, some in the driver, some in the network, some inside the database itself.

Under the hood

Picture four boxes: your app, the driver library, the network connection, and the database server, each with its own job and its own security responsibility.

Real-world use

  • Web application code review
  • Backend development
  • Database administration
BoxIts jobA security responsibility it has
Your applicationDecides what query to run and with what valuesBuild the query safely; validate input
Driver libraryTurns your call into the wire protocolCorrectly separates SQL text from bound values
Network connectionCarries bytes between app and serverUse TLS/SSL so data is not readable in transit
Database serverParses, plans, executes, enforces permissionsGrant only the access the app account needs
Careful:A compromise of any one box can partly undermine the others. That is exactly why this course has a separate part for validation, a separate part for access control, and a separate part for monitoring.

Quick quiz

1. Which box decides what query text to send?