connection check
# exposed
k
connection check
s
It is not immediately clear to me why that is the case
k
Sorry, I could have picked a better error message, that’s not actually DB related but file permission related. An example could be “database locked” or something
s
Oh sorry. Replied to the wrong message. I meant that it is not clear why it would create leaks. Have you had a look at the code?
k
I haven’t actually, I’ll check it out
I did a diff on the 0.9 tag and the 0.10 tag, and I think these are the relevant bits: (linking to a diff doesn’t work seem to work, so instead I’ll link to master) https://github.com/JetBrains/Exposed/blob/master/src/main/kotlin/org/jetbrains/exposed/sql/Database.kt#L92 https://github.com/JetBrains/Exposed/blob/master/src/main/kotlin/org/jetbrains/exposed/sql/transactions/TransactionApi.kt#L53 So it looks like it’s making a new connection each time and appending it to a registry list
s
Looks like there ought to be a mechanism to remove them from
registeredDatabases
k
Well I can actually specify a particular database in a transaction, so maybe that is all I need to do?
Actually I don’t think that’s it. I really have no idea
s
If you need to do is check the connection why dont you just use straight up JDBC?
k
That’s a good idea 👍
t
I guess that you make your own cache/map like:
Copy code
val databases = hashMap<String,Database>()
fun resolveDb(filePath: String) = databases.getOrPut(filePath){ Database.connect() }
👍 1