[Tutor] python on windows / mysql on linux

Pedro Diaz Jimenez pdiaz88@terra.es
Thu, 5 Apr 2001 01:19:35 +0200


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Thursday 05 April 2001 00:16, Rick Pasotto wrote:
> How can I access a MySQL database on my linux box from my windows box
> using python? Python on the linux box works great.
Does python on the win box work?

Yes, MySQL can accept queries over a network. Suposing that the MySQL module 
is also supported on the Win box, you only have to use the connect() method. 
An easy example:

import MySQLdb

db_conn = MySQLdb.connect( user="myuser", passwd="mypasswd", db="mydb",\ 
host="myhost" ) 
db_cur = db_conn.cursor()
db_cur.execute( some_query )
print db_cur.fetchone()



Take a look at the DB API in the python doc

Cheers
Pedro
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.4 (GNU/Linux)
Comment: For info see http://www.gnupg.org

iD8DBQE6y6wHnu53feEYxlERAnOrAKDIiy0vOpJ9VTHN6p39EMtXeN1AWACgyYht
XV5zxGBs6RtXlUyNYiTLpF0=
=TCsA
-----END PGP SIGNATURE-----