Why is this throwing a `JdbcSQLException: Database...
# exposed
w
Why is this throwing a
JdbcSQLException: Database is already closed (to disable automatic closing at VM shutdown, add ";DB_CLOSE_ON_EXIT=FALSE" to the db URL)
while close on exit = false is already set?
Copy code
@Before
    fun setupDatabase() {
        Database.connect("jdbc:h2:mem:test;DB_CLOSE_ON_EXIT=FALSE;DB_CLOSE_DELAY=-1", "org.h2.Driver")

        // create tables
    }

    @After
    fun tearDownDatabase() {
        transaction {
            exec("SHUTDOWN;")
        }
    }
t
I'm not sure that you need
DB_CLOSE_ON_EXIT=FALSE
if you running tests (if it tests ofc) within single run. I use same approach here : https://github.com/JetBrains/Exposed/blob/6c80f309d4409cadfd1540494683a7a197a4ab08/src/test/kotlin/org/jetbrains/exposed/sql/tests/h2/MultiDatabaseTest.kt
w
I want to test my application that uses many
transaction
blocks, how should I do that? I thought setting the close delay to -1 would work, but it doesn't?
t
I think that`tearDownDatabase` executes on evert Test function and shutdown closes db after first one. Try to remove
after
block