Zope And MySQL - Making The Connection (
Page 2 of 9 )
First up, that all-important question: why? Why on earth would you want to connect
your Zope system to an external database, especially since Zope already comes
with its own, very cool ZODB?
There are a couple of reasons why you might want to do this:
First, if your data is already in an existing RDBMS, you're usually going to
find it tedious and time-consuming to migrate it all to to Zope's own database.
It's far easier (not to mention less disruptive to your users) to leave your data
where it is, and simply get Zope to talk to your existing RDBMS so that you can
access the data within it in a simple, transparent manner.
Second, Zope's own database is not really meant to perform the same tasks as
a full-fledged RDBMS. The ZODB is a very powerful object database which keeps
track of all the different objects you use in Zope, and it comes with some very
neat transaction and versioning features. However, it's optimized to read data,
not write it, and so INSERT and UPDATE queries tend to be sub-optimal on this
database.
For a more detailed discussion of why you might prefer an SQL database over the
ZODB, take a look at
http://www.zope.org/Members/anthony/sql_vs_ZODB
It should be noted at this stage that, in addition to the ZODB, Zope does come
with a small, SQL-compliant RDBMS named Gadfly, which can be used if your requirements
aren't too complex. If, however, you're dealing with large record sets or complex
queries, you will probably find Gadfly too slow and inefficient for your needs,
and you will need to explore the possibility of connecting Zope to a more professional
and full-featured RDBMS.