https://kotlinlang.org logo
#exposed
Title
# exposed
d

Dominick

04/28/2021, 4:02 AM
It's possible that my database doesn't connect. I just went into my database and it doesn't seem that it created anything:
Copy code
val dataSource = HikariDataSource().apply {
        maximumPoolSize = 20
        driverClassName = "com.mysql.jdbc.Driver"
        jdbcUrl = File("jdbc_url.txt").readText()
        isAutoCommit = false
    }

    Database.Companion.connect(dataSource)

    transaction {
        SchemaUtils.create(MediaPropertiesTable)
        SchemaUtils.create(MediaContentTable)
        SchemaUtils.create(UserAPIKeysTable)
        SchemaUtils.create(UserTable)
    }
The file jdbc_url.txt does exist and has a connection url generated from pterodactyl UPDATE: Tried removing pterodactyl from the equation and still doesnt work. It gets past the create code and all, nothing gets logged even after adding
addLogger(StdOutSqlLogger)
and the tables arent in the db.
1
b

Bogdan

04/28/2021, 2:36 PM
maybe the problem is in
autoCommit = false
, try like this:
Copy code
transaction { 
  // create 
  commit () 
}
the query is displayed in the log?
jdbc_url.txt
- are you sure the URL is correct?
Also, first create a HikariConfig, and already from it we get a HikariDataSource. True, I am not too familiar with Hikari
t

tapac

04/28/2021, 7:28 PM
@Dominick , can you connect to database without the HikariDataSource? Also I can't see that you provide username/password, are they in jdbc_url?
d

Dominick

04/29/2021, 9:34 AM
I've solved the problem, in the end I think it was the jdbc url & the connector, I switched to a mysql jdbc url and specifying the username & password with addDataSourceProperty, and ensuring the connector I depended on was mysql-connector-java, even though it's a mariadb.
6 Views