Show how to close a connection

This commit is contained in:
Raymond Hettinger 2012-09-25 19:57:50 -04:00
parent a4fd0dc574
commit 1b43274d12
1 changed files with 3 additions and 2 deletions

View File

@ -42,8 +42,9 @@ and call its :meth:`~Cursor.execute` method to perform SQL commands::
# Save (commit) the changes # Save (commit) the changes
conn.commit() conn.commit()
# We can also close the cursor if we are done with it # We can also close the connection if we are done with it.
c.close() # Just be sure any changes have been committed or they will be lost.
conn.close()
The data you've saved is persistent and is available in subsequent sessions:: The data you've saved is persistent and is available in subsequent sessions::