1000copy@gmail.com

»¶Ó­À´µ½1000copy@gmail.com>>¡¡¡¡ | Ê×Ò³ ×ÊÔ´ÖÐÐÄ | ÔĶÁ | Python | רÀ¸Ñ§Ï°technet ϵÁÐ¿Î³Ì | ¸öÈËÄ¿±ê | ¼ÒÈË | ÍæÀÖ | ¼¼Êõ | ITPUBÂÛ̳

ѧϰ sqlobject

·¢±íÈË:1000copy | ·¢±íʱ¼ä: 2006ÄêÆßÔÂ05ÈÕ, 22:29

1. °²×°activepython

2. °²×°ez_install

3. ÏÂÔØ mysqldb È»ºó ²âÊÔ

import MySQLdb Çø±ð´óСд£¬Ã»Óб¨´í¾ÍÊǶԵġ£

3. ÏÂÔØ formencode.egg È»ºó python easy_install formencode.egg

4. ÏÂÔØ sqlobject.egg È»ºó python easy_install sqlobject.egg

import sqlobject Çø±ð´óСд£¬Ã»Óб¨´í¾ÍÊǶԵġ£


1¡£mysqlÏêϸ²âÊÔ

def viewmysql():
# import MySQL module
import MySQLdb
db = MySQLdb.connect(host="localhost", user="root", passwd="",db="test")
cursor = db.cursor()
cursor.execute("use phpmyadmin")
cursor.execute("select * from pma_column_info")
result = cursor.fetchall()
print result
viewmysql()

2¡£TroubleShooting

µÚ4²½×îΪΣÏÕ£¬ÎÒÔÙpythonwinÖÐÖ´ÐУ¬µÚ¶þ´ÎÖ´ÐÐʼÖÕÏÔʾµÄÊÇ

ValueError: class Person is already in the registry (other class is <class '__main__.Person'>, from the module __main__ in (unknown); attempted new class is <class '__main__.Person'>, from the module __main__ in (unknown))

¼òÖ±¿´²»¶®£¬ÓÐЩÏóÊÇ×îÔçʹÓÃjavaµÃnullpointexception ,Ò»²ã²ãµÄ¶ÑջǶÌ×£¬ÕæµÄÒª°ÑÈËÏÅÍ˵ġ£

·¢±íÆÀÂÛ

±êÌâ

ÔÚ´ËÌí¼ÓÆÀÂÛ

³Æºô

ÓÊÏ䵨ַ£¨¿ÉÑ¡£©

¸öÈËÖ÷Ò³£¨¿ÉÑ¡£©




Valid XHTML 1.0 Strict and CSS. Powered by pLog
Design by Blog.lvwo.com