close()

Overview

When called on a connection object, the connection will be closed down, including all connection-derived objects such as cursors. If close() is not called by the client, it will be implicitly called when the connection object is destroyed.

When called on a cursor, it closes out any pending or unread results, which allows the associated connection to be used for other operations via other cursors.

When called on a pool, it closes the pool and all its connections.

See also: MariaDB Connector/Python 1.1 and in 1.0

EXAMPLES

import mariadb

conn = mariadb.connect(
    host = 'localhost',
    user = 'root',
    password = 'secret',
    )

cursor = conn.cursor()

# ... do DB operations ...

cursor.close()

conn.close()

CHANGE HISTORY

Release Series

History

1.1

  • Present starting in MariaDB Connector/Python 1.1.0rc1.

1.0

  • Present starting in MariaDB Connector/Python 1.0.0.