https://kotlinlang.org logo
Title
r

Rohit Singh

06/27/2020, 8:19 AM
Hi I am new to ktor and working on a sample project. What do you guys use for mysql connection ?
d

deactivateduser

06/27/2020, 9:28 AM
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

napperley

06/28/2020, 1:40 AM
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

deactivateduser

06/28/2020, 1:53 AM
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

Anders Sveen

06/29/2020, 8:04 AM
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

deactivateduser

06/29/2020, 8:14 AM
thanks @Anders Sveen,fair enough... have never used JDBI previously, I might take a look on it as well, looks quite interesting... 👌
r

renghen pajanilingum

06/29/2020, 2:56 PM
Exposed is very good for crud
👍 5
works well with hikari
a

asad.awadia

06/30/2020, 12:58 AM
Jdbi and hikari
👍 1