ehxz 发表于 2005-7-9 14:14:53

Installing MySQLdb and ZMySQLDA for Zope in Windows 2000/Windows XP

<H3>Installing MySQLdb and ZMySQLDA for Zope in Windows 2000/Windows XP</H3>
<P><a href="http://www.pastrytech.com/willy/Zope-and-MySQL-Windows.zip" target="_blank" >Zope-and-MySQL-Windows.zip</A> (184 k)
<P>Included readme.txt:
<P><PRE>November 22, 2003

Versions these files **APPEARED** to work with (see DISCLAIMER below):

    Zope 2.6.2
    MySQL 4.0.15

Other combinations, more recent versions, past versions, etc. of the
above, below, and included files may be preferable.I have no idea.
All other combinations of the packages below (MySQLdb and ZMySQLDA)
that I tried caused Zope to fail upon startup or required a C compile.

I'm putting these instructions online with all the files in one package
because it was a major pain to get MySQL support for Zope in Windows XP,
with little to no documentation available.I hope someone will find the
following useful.

(Since I put this online a month ago, at least 2 people have reported
that the following files and instructions also work with Windows 2000,
so I now mention it as well.)

-- INSTALLATION

1.<FONT color=darkblue>Shutdown Zope if running.</FONT>


2.<FONT color=darkblue>Copy the directory and files

    MySQLdb
    _mysql.pyd
    _mysql.exceptions.py
    _mysql.exceptions.pyc
    _mysql.exceptions.pyo

    tYourZopeInstallDir/lib/python/</FONT>

    MySQLdb (MySQL for Python) 0.9.1 allows Python to access MySQL using
    the Python DB API 2.0 syntax.Versions for Python 2.2 and greater
    don't seem to work.(At this writing, the current Python is version
    2.3.)
   
    (Source:http://sourceforge.net/projects/mysql-python )


2.<FONT color=darkblue>Copy the directory
   
    ZMySQLDA
   
    tYourZopeInstallDir/lib/python/Products/</FONT>

    This is the database adaptor used inside Zope.

    (Available from the same link above.)


3.<FONT color=darkblue>Restart Zope.</FONT>

    If the database adaptor is installed correctly, the item Z MySQL
    Database Connection should be available in the "add" dropdown list
    and ZMySQLDA should be listed in the collapsable menu (Products)
    in the left frame.

    You probably need to have installed MySQL and created at least 1
    database to add the connection object.The connection string is

      database user password

    or if there is no user/password simply

      database
   
    Click on the connection object to "browse" the database items or enter
    "test" SQL queries.If you can browse the database and successfully
    enter SQL instructions, the connection between Zope and MySQL **MAY**
    be complete.(See below.)

--FINISHED

Huge-ass DISCLAIMER:These files/instructions *APPEARED* to work for me
with Zope 2.6.2 and MySQL 4.0.15 on Windows XP Home Edition (5.1 Build
2600).Your mileage may vary.I guarantee nothing.NOTHING.Use this
at your own risk, your computer may explode, I am not responsible, if you
listen to me you're an idiot, etc. etc.

Aaron Maupin
maupin@pastrytech.com
November 22, 2003</PRE><PRE><a href="http://www.pastrytech.com/willy/zopemysql.html" target="_blank" >http://www.pastrytech.com/willy/zopemysql.html</A></PRE>

ehxz 发表于 2005-7-10 09:30:02

<P>按上面的处理后,报下面的错:</P>
<H3>Import Traceback</H3><PRE>Traceback (most recent call last):
File "C:\Program Files\Plone 2\Zope\lib\python\OFS\Application.py", line 654, in import_product
    product=__import__(pname, global_dict, global_dict, silly)
File "C:\Program Files\Plone 2\Zope\lib\python\Products\ZMySQLDA\__init__.py", line 91, in ?
    import DA
File "C:\Program Files\Plone 2\Zope\lib\python\Products\ZMySQLDA\DA.py", line 92, in ?
    from db import DB
File "C:\Program Files\Plone 2\Zope\lib\python\Products\ZMySQLDA\db.py", line 89, in ?
    import _mysql
ImportError: DLL load failed: 找不到指定的模块。
</PRE>
页: [1]
查看完整版本: Installing MySQLdb and ZMySQLDA for Zope in Windows 2000/Windows XP