Disconnecting Database in Python


To disconnect Database connection, use close() method.

db.close()

If the connection to a database is closed by the user with the close() method, any outstanding transactions are rolled back by the DB. However, instead of depending on any of DB lower level implementation details, your application would be better off calling commit or rollback explicitly.

Updated on: 31-Jan-2020

5K+ Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements