import MySQLdb
import threading
class MultiThread(threading.Thread):
def __init__(self, cx):
super(MultiThread,self).__init__()
self.counter = cx
def run(self):
myconn = MySQLdb.Connect(host='localhost',user='root',passwd='a',db='DTSClient')
myconn.autocommit(1)
mysql = "Call testproc(1,1);"
mycursor = myconn.cursor()
result = mycursor.execute(mysql)
print result
myconn.close()
blist = []
for cx in range(50):
bg = MultiThread(cx)
blist.append(bg)
for bx in blist:
bx.start()
Untuk stored procedure dengan menggunakan Transaction lihat blog sebelum ini.