MySQL Forums
Forum List  »  Connector/Python

Re: mysql.connector.django is leaking connection
Posted by: Marion Gordon
Date: August 24, 2014 11:09PM

Hay friend,
You want to close the python 1.2.2 please use the following query for clearing that

#!/usr/bin/python

import MySQLdb

# Open database connection
db = MySQLdb.connect("localhost","testuser","test123","TESTDB" )

# prepare a cursor object using cursor() method
cursor = db.cursor()

# Prepare SQL query to DELETE required records
sql = "DELETE FROM EMPLOYEE WHERE AGE > '%d'" % (20)
try:
# Execute the SQL command
cursor.execute(sql)
# Commit your changes in the database
db.commit()
except:
# Rollback in case there is any error
db.rollback()

# disconnect from server
db.close()

Options: ReplyQuote


Subject
Written By
Posted
Re: mysql.connector.django is leaking connection
August 24, 2014 11:09PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.