Connecting to the Database
Learn how to connect to a database in Ktor application using Kotlin language.
We'll cover the following...
To store and retrieve cat data , we’ll need to connect to a database. We’ll use PostgreSQL for that purpose, although using another SQL database won’t be any different.
Adding the exposed
library
First, we’ll need a new library to connect to the database. We’ll use the Exposed library, which is also developed by JetBrains.
Let’s add the following dependency to our build.gradle.kts
file:
dependencies {
implementation("org.jetbrains.exposed:expos
...