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 modern programming language Kotlin. The author, Alexey Petrov, an experienced developer and teacher, has compiled everything needed to create reliable and high-performance data-driven applications under one cover.
What is this book about?
The book covers the full cycle of working with databases in Kotlin — from the simplest operations to complex architectural solutions. You will start with the basics of SQL and environment setup, and then move on to practical examples of using popular technologies. Special attention is given to:
- Working with relational databases (SQLite, PostgreSQL, MySQL) via JDBC and connection pools.
- Modern ORM libraries for Kotlin: Exposed (JetBrains) and Room (for Android development).
- Database schema migrations using Flyway and Liquibase.
- Query optimization, indexing, and performance profiling.
- Asynchronous database work using Kotlin coroutines and the R2DBC library.
- Integration with the Ktor and Spring Boot frameworks.
Who is this book for?
- Beginner Kotlin developers who want to learn how to connect and use databases in their projects.
- Android developers looking to master Room and local data storage.
- Backend developers working with Ktor or Spring who need practical examples of working with PostgreSQL and MySQL.
- Anyone transitioning from Java to Kotlin who wants to understand how to effectively work with databases in the new language.
What will you learn after reading?
- How to set up a connection to any popular DBMS from a Kotlin application.
- How to write safe SQL queries and avoid SQL injections.
- How to use the Exposed DSL for type-safe work with tables.
- How to design a database schema and perform migrations without data loss.
- How to test code that works with databases using in-memory databases and mocks.
- How to integrate databases into Ktor and Spring Boot applications.
- Basics of designing high-load systems and data caching.
The book contains many ready-to-use code examples that you can immediately apply in your projects. All examples are accompanied by detailed comments and explanations. This is not dry theory, but a practical guide that will help you save hours of searching for information on the internet.
"Kotlin and Databases: A Practical Guide" will become a desktop book for anyone who wants to write clean, maintainable, and high-performance code for working with data in Kotlin.