Database Management · Intermediate level

Intermediate level · Module 5 of 6 · 13 guided hours

Using Databases from Applications

Connect to databases from application code, run parameterised queries, manage connections and understand ORMs.

Learning objectives

  • Connect to a database from code and run queries
  • Prevent SQL injection with parameters
  • Manage connections and understand ORMs

Topics

  • database drivers
  • connection strings and configuration
  • parameterised queries
  • SQL injection
  • transactions from code
  • ORMs and query builders

Lessons

  1. Lesson 1 Connecting from Code

    Connect to SQLite or PostgreSQL from a program, run queries and read results.

    database driverconnection stringcursor and resultsclosing connections

  2. Lesson 2 Parameterised Queries and SQL Injection

    Pass values safely to SQL with parameters, and understand how injection attacks work.

    SQL injectionplaceholdersparameter bindinginput validation

  3. Lesson 3 Transactions, Connections and ORMs

    Use transactions from code, manage connections efficiently and understand what ORMs do.

    commit and rollback in codeconnection poolingORMN+1 query problem

Practical activity

Write a Python script that registers households from a form-like input using parameterised queries and a transaction.

Expected outcomes

  • Safe database code
  • Understanding of how applications use databases

Assessment

Code review against a checklist (parameters, transactions, closed connections, no secrets in code) and a demonstration.

Taught live by an instructor — online or in person. Free course lessons are for self-study and do not lead to a certificate — see registration options.