https://kotlinlang.org logo
#announcements
Title
# announcements
n

nyxcode

08/10/2019, 6:44 PM
Hey, what's the current state of database support in kotlin? I plan on building a rest api using ktor. Suprisingly, I couldn't find a proper async driver for MariaDB. Is there a reliable JDBC wrapper using kotlin coroutines?
m

Mark Murphy

08/10/2019, 6:49 PM
Exposed is the official solution from JetBrains, though coroutines support is still on the roadmap: https://github.com/JetBrains/Exposed
n

nyxcode

08/10/2019, 6:51 PM
hm exposed looks promising.. I'd just use my own threadpool for the blocking calls to the db then, right?
m

Mark Murphy

08/10/2019, 6:54 PM
I haven't used ktor, so I can't really comment on how it, coroutines, and something like this would blend -- #exposed or #ktor might be better places to confirm that
n

nyxcode

08/10/2019, 6:55 PM
ok, ill ask there. thanks for your help, really appreciate it!
👍 1
m

mbonnin

08/10/2019, 7:16 PM
SQL Delight might be able to do this at some point. See https://github.com/square/sqldelight/issues/1009. I'm using it on the client side with a SQLite backend and it's working great, including coroutines flow support.
m

Mark Murphy

08/10/2019, 7:18 PM
cool -- I didn't know they were thinking about databases beyond SQLite!
r

Robert Menke

08/10/2019, 7:30 PM
#exposed is not an “official” JB project AFAIK. It’s maintained by members of the JetBrains team, which is a separate designation.
@nyxcode
n

nyxcode

08/10/2019, 7:32 PM
@Robert Menke good to know, thanks
m

Mark Murphy

08/10/2019, 7:33 PM
my apologies for missing the distinction there -- I'll try to be more careful!
n

nyxcode

08/10/2019, 7:34 PM
SQL Delight looks awesome, let's hope it gets MariaDB support soon 😄
to be completely honest, it's a bit frustrating to see that sql support is still lacking.. while exposed looks promising, it's not well documented and oficially "experimental". Maybe I'll just use plain old JDBC with my own threadpool, idk..
m

mbonnin

08/10/2019, 7:45 PM
Make it open source 😁
r

Robert Jaros

08/10/2019, 7:47 PM
I'm just experimenting with r2dbc - it's non-blocking, and works fine with kotlin coroutines (although I have some issues with object mapping)
n

nyxcode

08/10/2019, 7:48 PM
@Robert Jaros interresting! What database are you using it for?
r

Robert Jaros

08/10/2019, 7:48 PM
postgresql
but the drivers are available for other databases
including mysql/mariadb
n

nyxcode

08/10/2019, 7:50 PM
ah, i see. https://github.com/mirromutth/r2dbc-mysql seems to be the only driver for mysql/mariadb, it doesn't seem to support coroutines though.
r

Robert Jaros

08/10/2019, 7:52 PM
I'm using it without problems with official coroutines reactive extensions
n

nyxcode

08/10/2019, 7:57 PM
hm, thats interresting. I'll give it a try right now! thanks.
yeah.. that seems to work, but i kinda dislike the bloated spring reactor stuff.. i'll just invest some time and build a dead-simple async jdbc wrapper myself.
g

Gunslingor

08/10/2019, 10:01 PM
I am building a rest api and started out with exposed. works fine, wish there was an automatic way to generate these Table objects from SQL or even better and .mwb file. In building the rest API however I ended up with spring boot... so I'm planning on removing exposed soon to minimize the frameworks I'm using and because setting up SSL looked less obvious with exposed. I've been studying kotlin a lot lately, IMHO its fully matured as a jvm scripting language... but everything else is experimental and really may not go anywhere... IMHO.
r

Robert Menke

08/10/2019, 10:06 PM
I mean it’s definitely not a scripting language
#exposed may not go anywhere, but #ktor, for example, should be here to stay
g

Gunslingor

08/10/2019, 10:08 PM
Yeah I guess its not a scripting language... well, in the kotlin/js I guess it is since it compiles to a scripting language. lol... it is what it is... its definitely a language we can agree on that, lol
d

dave08

08/18/2019, 5:10 AM
#jasync-sql
6 Views