dany giguere

    dany giguere

    8 months ago
    Hello everyone. I’m in a Ktor project and I’m trying to install exposed. In which file am I supposed to put this :
    val config = HikariConfig().apply {
        jdbcUrl         = "jdbc:<mysql://localhost/dbname>"
        driverClassName = "com.mysql.cj.jdbc.Driver"
        username        = "username"
        password        = "secret"
        maximumPoolSize = 10
    val dataSource = HikariDataSource(config)
    from the documentation here:

    Endre Deak

    8 months ago
    I guess you can put it anywhere as long as this code is executed when the server starts.


    8 months ago
    You can also put it in your DI to provide a Database instance for your repositories, especially if you have more than one database. Then you'd use
    transaction(db) {}