Kotlin and Databases: A Practical Guide
Kotlin and Databases: A Practical Guide
Summary:
The book "Kotlin and Databases: A Practical Guide" is a comprehensive resource for developers who want to master working with databases in the Kotlin language. The author, experienced developer Alexei Sokolov, systematically guides the reader from simple SQL queries to complex integrations with modern DBMS.
What is this book about?
The book covers all key aspects of working with data in Kotlin applications:
- SQL and JDBC Basics — connecting to databases, executing queries, working with ResultSet.
- Embedded SQLite DBMS — local data storage for mobile and desktop applications.
- Room — the official Android library for working with databases (DAO, Entity, migrations).
- Exposed — a lightweight Kotlin framework for working with SQL without unnecessary magic.
- PostgreSQL and H2 — configuring connection pools, working with transactions and isolation.
- Schema Migrations — managing database versions with Flyway and Liquibase.
- Query Optimization — indexes, profiling, working with large data volumes.
- Testing — writing unit tests for the DAO layer with in-memory databases.
Who is this book for?
- Beginner Kotlin developers who want to add database work to their skillset.
- Android developers looking to deepen their knowledge of Room and SQLite.
- Backend developers using Kotlin on the server (Ktor, Spring Boot) and needing PostgreSQL or MySQL.
- Anyone wanting to switch from Java to Kotlin — the book shows how to idiomatically work with data in the new language.
What will you learn after reading?
- How to design database schemas and avoid antipatterns.
- How to use Kotlin-specific features (data class, extension functions, null-safety) for working with databases.
- How to implement CRUD operations in various DBMS.
- How to perform migrations without data loss.
- How to optimize query performance and avoid N+1 problems.
- How to write tests for the data access layer.
Each chapter contains practical examples with complete code that can be run immediately. The book is written in a lively style, without excessive academicism, and is suitable both for self-study and for use as a reference.
Whether you are creating a mobile application, a web service, or a desktop tool — this book will help you confidently work with data in Kotlin.
Recommendations
Swift (iOS/macOS) Application Architecture. Patterns and Practices
Swift (iOS/macOS) for Data Science: Machine Learning, Neural Networks, and Data Analysis on Your Device
Machine Learning and Java: A Practical Guide
C# in Depth (4th Edition)
Principles, Practices, and Patterns of Unit Testing
Concurrency Techniques in Kotlin