https://kotlinlang.org logo
v

vagarwala

07/10/2019, 12:43 AM
question: i have a postgres database that i’m running via docker, and connecting to via exposed. This is a database that persists and is created in my docker-compose and so the schema isn’t locally defined in my kotlin file. i’ve been able to connect to it using
Database.connect()
, but the only way I can interact with it is by using raw sql statements (and this works). any way I can access the values of some fields and use that information to do other things? for reference, this is what I currently have:
Copy code
val db = Database.connect("jdbc:<postgresql://localhost:5433/<dbname>>",
                        driver = "org.postgresql.Driver",
                        user = "user",
                        password = "pass")
transaction{
                        val conn = TransactionManager.current().connection
                        val statement = conn.createStatement()
                        val query = "<postgresql insert and update statement>"
                        statement.execute(query)
                }