[Zope] Making a Database Connection to MySQL

Andy Dustman adustman@comstar.net
Sat, 25 Sep 1999 13:10:23 -0400 (EDT)


On Fri, 24 Sep 1999, James Punteney wrote:

> Hello,
> 
> I'm looking at switching from using PHP to Zope for an intranet 
> application.  The problem is I can't find how to add another database (in 
> this case a MySQL DB).  Basically I've installed Zope 2.0.1 and everything 
> is working, now what do I have to connect to MySQL.

First, you need the MySQL database adapter, i.e. ZMySQLDA. It appears you
can get this from a link at:

    http://www.zope.org/Members/philh/mysql

Note that ZMySQLDA comes with MySQLmodule-1.4, which is the Python
interface. However, it is designed for MySQL-3.21. I don't think it works
with MySQL-3.22, and in any case, when it runs, it will block all other
threads, which is a bad thing.

I have my own Python interface to MySQL, and it includes a patch to
ZMySQLDA which modifies it to use the new interface. You can find this
package at:

    http://www.zope.org/Members/adusman/MySQLdb

Once you unpack ZMySQLDA over your Zope installation and apply the patch,
you'll need to restart Zope so it knows about the new Product. Then to
actually use it, you can create a MySQL Connection Object. The connection
string is formatted: database@host user password.

-- 
andy dustman       |     programmer/analyst     |      comstar.net, inc.
telephone: 770.485.6025 / 706.549.7689 | icq: 32922760 | pgp: 0xc72f3f1d