Close DB Connection in Slick 3.0

I use Slick 3.x with Play 2.3.9 without play-slick, because play-slick does not support this combination. I read

http://blog.knoldus.com/2015/03/03/play-with-reactive-slick-a-simple-crud-application-in-play-framework-using-slick-3-0/

And he mentioned that the database connection should be explicitly closed ie

def delete(id: Long): Future[Int] =
    try db.run(filterQuery(id).delete)
    finally db.close

Do I need to close the connection explicitly, as indicated in the article? Will db.closeclose the connection and pool? Because OTH, the examples in the Slick 3.0 document did not explicitly close the connection. I could misunderstand the document. Thanks

+4
source share
2 answers

MySQL, show processlist , , , , . , db db.run(...), db.close .

+2

db.close . , , . , db, , .

db.close . db.run()

+1

Source: https://habr.com/ru/post/1611363/


All Articles