is there any method like `Database.disconnect`
# exposed
r
is there any method like
Database.disconnect
s
I dont think there is a standard JDBC but we have one on
HikariDataSource.close()
t
Database.connect() doesn't create any real connection, but just collect all required data for it. So you don't need to disconnect anything. But if want unregister database and related TransactionManager please use TransactionManager.closeAndUnregister() function
But if you want to close Connection pool use @spand advise
r
Thanks. And also sorry, could you please tell me what
closeAndUnregister()
? I thought that would be
val db = Database.connection(...)
, but it isn't it.
I don't use Data Source so it's not for me now.
t
Copy code
val db = Database.connect(...)
// .... your code
TransactionManager.closeAndUnregister(db)
r
Oh thanks! The code works great
👌 1
147 Views