MySQL Forums
Forum List  »  Connector/Python

Re: help : Problem in connection(python with mysql)
Posted by: pratik shah
Date: April 27, 2009 05:00AM

Just apply this code and your problem will be solved
1.
import MySQLdb
2.

3.
conn = MySQLdb.connect (host = "nephews", user = "huey", passwd = "dewey", db = "louie")
4.
cursor = conn.cursor ()
5.
table_name = "kumquat"
6.

7.
nlines = cursor.execute ("DROP TABLE IF EXISTS " + table_name)
8.
for x in range(nlines):
9.
print cursor.fetchone ()
10.
cursor.close ()
11.

12.
tdesc = "CREATE TABLE " + table_name + "("
13.
tdesc = tdesc + "IDseq INT(7) UNSIGNED,"
14.
tdesc = tdesc + "Protocol VARCHAR(8), "
15.
tdesc = tdesc + "Function VARCHAR(8), "
16.
tdesc = tdesc + "Threads INT(10) UNSIGNED, "
17.
tdesc = tdesc + "Speed DECIMAL(10,3) "
18.
tdesc = tdesc + ")"
19.
cursor = conn.cursor ()
20.
nlines = cursor.execute (tdesc)
21.
for x in range(nlines):
22.
print cursor.fetchone ()
23.
cursor.close ()

Future Desings And Gadgets only at: http://techonova.com
Latest Technology News and Updates by http://technologytoday.in
Latest World News : http://technologytoday.in/category/world-news/

Options: ReplyQuote


Subject
Written By
Posted
Re: help : Problem in connection(python with mysql)
April 27, 2009 05:00AM


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.