https://kotlinlang.org logo
#server
Title
j

João Esperancinha

10/11/2022, 6:13 PM
Hey people!, Anyone knows how to get an SQL connection to PostgresSQL via Kotlin Native? I'm scrambling to get this done and I'm, already looking at the possibility of calling postgress command natively by making my own library, but maybe I'm just missing some easier solution?
h

hfhbd

10/11/2022, 8:10 PM
I just use libpq: https://github.com/hfhbd/postgres-native-sqldelight While the driver inherits from sqldelight SqlDriver, you could use it without sqldelight too.
👍 1
j

janvladimirmostert

10/11/2022, 9:30 PM
building your own driver is the fun part, but be prepared to sink a few months into that, unless you've built a database driver before shout if you need help with a custom PostgreSQL driver
🙌 1
👍 1
j

Jonas TM

10/11/2022, 9:57 PM
I think the expose framework has it on the roadmap but did not see any work happen on it yet.
j

João Esperancinha

10/18/2022, 10:13 PM
Hey @hfhbd, thanks for sharing your repo! It really helped me out a lot. I wasn't able to get the specific configuration you have there to work with Ktor. The def file config seems to pick up a different compiler , or the postrgres binaries have an issue, I have no idea. What does work for me with Ktor is creating the link file separately (the .a file) and then using the def file to link that to the Kotlin Native code. Works like a charm.
h

hfhbd

10/19/2022, 6:11 AM
Could you file an issue? I use the same config, ktor + postgres native
3 Views