Connecting to MySQL

Uwe Schmitt schmitt at num.uni-sb.de
Tue May 15 23:09:58 CEST 2001


Darren Watson <Darren.Watson3 at ntlworld.com> wrote:
| Hi

| Can anyone give me any pointers about how to connect to MySQL on Windows
| using Python 2.1?

| I am fairly new to Python,

| Many Thanks


using ADO, you can write:


   from win32com.client import Dispatch

   con = Dispatch("ADODB.Connection")
   con.Open("DSN=MyDatasource")

   rs,error = con.Execute("select * from MyTable")

   print "--------------"
   while not rs.EOF:
	   print rs("Vorname")
	   print rs("Name")
	   print rs("Telefon")
	   print "--------------"
	   rs.MoveNext()



yours, uwe

-- 
Uwe.Schmitt at num.uni-sb.de      Universität des Saarlandes
phone: +49 (0)681/302-2468     Geb. 36.1, Zi. 4.17, PF 151150
                               D-66041  Saarbrücken
http://www.rocksport.de        http://www.rocksport.de/first_ride.mp3




More information about the Python-list mailing list