
November 16th, 2003, 08:00 PM
|
|
Contributing User
|
|
Join Date: Mar 2003
Posts: 325
Time spent in forums: 7 h 58 m 36 sec
Reputation Power: 11
|
|
|
MySQL Problem - connection dies after too many queries
Hi, I'm writing an application and I'm testing it with large data for speed, but I can't even load it!
MySQL dies after about 2000 queries.
I'm going to need a few 100,000's to load it up.
Anyone had this problem before ??
Eli
p.s. Does it have to do with me not closing something after each query ? Here's my db.py file that I use for each query :
Code:
#!/usr/bin/python
import MySQLdb
### return a mysql cursor handle
def connect():
### set database parameters
host = "localhost"
user = ""
pwd = ""
db = "video_store"
### connect
db = MySQLdb.connect(host, user, pwd, db)
### return the db object
return db
### this can be called on its own with a query as argument
### it returns the result
def executeQuery(query):
### create a db object
### if not in this file, use: "mydb = db.connect()"
mydb = connect()
### get the db handle
handle = mydb.cursor()
### execute the query
handle.execute(query)
### get the results
result = handle.fetchall()
### close the db connection
mydb.close()
### return the results
return result
|