Hi I am new to ktor and working on a sample projec...
# server
r
Hi I am new to ktor and working on a sample project. What do you guys use for mysql connection ?
d
i think it is not really related with ktor. To use MySQL, you can either use JPA on top of MySQL JDBC connector library.
n
It is strongly recommended to use either JDBC ( https://docs.oracle.com/javase/tutorial/jdbc/basics/index.html ), or JOOQ ( https://www.jooq.org/ ). On Kotlin JVM projects using a Relational DB I use JOOQ. JPA is very difficult to work with especially when things go wrong.
d
What would make JPA difficult to work with Kotlin JVM? I don't see JDBC is really a recommendation nowadays. JPA is just an abstraction layer on top of JDBC and in fact it can be used along with JOOQ.
a
JPA isn't especially hard on Kotlin, but in my view too complex in general that I would choose it. I've seen some really weird usages over time. 🙂 I would usually reach for JDBI, or something similar at least. Simple API with simple row mapping.
d
thanks @Anders Sveen,fair enough... have never used JDBI previously, I might take a look on it as well, looks quite interesting... 👌
r
Exposed is very good for crud
👍 5
works well with hikari
a
Jdbi and hikari
👍 1