On Thu, 19 Jan 2006, John Joseph wrote:
> Hi > I tried out my first Pyhton program with MySQL > I was trying to get the some result , eg > describe table, select * from table Hi John, Unlike Java, Python doesn't force you to put everything in a class. You can try the simpler: ###### import MySQLdb db = MySQLdb.connect(host="localhost",user = "john",password = "asdlkj", db = learnpython) cursor = db.cursor() cursor.execute(" describe contact" ) cursor.execute(" SELECT * from contact" ) ###### from toplevel. > but my program does not give the expected results , What do you expect to see, and from where? A call to cursor.execute() sets the cursor up so that subsequent calls to cursor.fetchone() will give us result rows. See: http://www.amk.ca/python/writing/DB-API.html You need to add some code to print out the result set. The link above is a tutorial to the database interface that should help you get started. Good luck! _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor