Zope
  Home arrow Zope arrow Page 3 - Zope And MySQL
Dev Shed Forums 
Administration  
AJAX  
Apache  
BrainDump  
DHTML  
Flash  
Java  
JavaScript  
Multimedia  
MySQL  
Oracle  
Perl  
PHP  
Practices  
Python  
Reviews  
Security  
Style-Sheets  
Web Services  
XML  
Zend  
Zope  
Forums Sitemap 
IBM® developerWorks 
Sun Developer Network 
Dedicated Servers 
E-Commerce Hosting 
Linux Web Hosting 
Managed Hosting 
Small Business Hosting 
Actuate Whitepapers 
VeriSign Whitepapers 
VPS Hosting 
Weekly Newsletter

 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
ZOPE

Zope And MySQL
By: icarus, (c) Melonfire
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 26
    2002-04-10

    Table of Contents:
  • Zope And MySQL
  • Making The Connection
  • Adapting To The Environment
  • The Magic Of The Movies
  • Visiting The Box Office
  • Adding Things Up
  • Submitting To The King
  • Erasing The Past
  • Of Methods And Madness

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT

    Stay one step ahead of the competition. Evaluate and give feedback on some of the hottest web development tools on the market today. Make your opinion heard! Click Here

    Zope And MySQL - Adapting To The Environment


    (Page 3 of 9 )

    Normally, setting up a connection between Zope and an external RDBMS like MySQL, Oracle, PostgreSQL or even Gadfly requires two things: a Database Connection object, which is used to perform communication between Zope and the specified database, and one or more Z SQL methods, which are used to execute queries on the database.

    Zope comes with adapters for a variety of different databases, including ODBC, Oracle, MySQL and Interbase. I'll be connecting Zope to a MySQL database in this article; however, the process is similar for other database systems.

    Hooking Zope up to MySQL is a little tedious, especially if you attempt to do it solely on the basis of the information available online. This is because much of the online documentation relating to Zope-MySQL connectivity is outdated and no longer relevant, and you can lose a whole day just trying out different variants of the techniques suggested. So let me make it as simple as possible.

    Getting Zope and MySQL to talk nice to each other requires you to install the following two pieces of software:

    1. The Zope MySQL Database Adapter (ZMySQLDA), available from http://www.zope.org/Members/adustman/Products/ZMySQLDA

    2. The Python MySQL Database Interface (MySQLdb), a Python MySQL driver available from http://www.zope.org/Members/adustman/Products/MySQLdb

    You can also find this software at http://sourceforge.net/projects/mysql-python

    The installation process is fairly simple.

    1. Install (copy) the ZMySQLDA files into Zope's Products directory (usually <Zope>/lib/python/Products).

    2. Extract the MySQLdb files to the same place. Configure and compile the driver (instructions are available in the source archive) using the Python binary that shipped with your version of Zope. This is extremely important, because if you don't use the exact binary that ships with your Zope installation, Zope won't know how to handle the driver.

    3. Install the compiled driver into your Zope build (again, instructions to accomplish this are available in the driver's documentation).

    4. Restart Zope.

    This process works on Linux; however, despite my best efforts, I was unable to get Zope and MySQL talking on Windows. It's certainly possible, though, and the process is about the same - take a look at http://zope.org/Members/philh/ZMySQLDA_html for some hints.

    Assuming all goes well, you should now see a new Z MySQL Database Connection object type in the Type drop-down list within the Zope management interface.



    If you don't see this item, it usually means that something bad happened during the installation process. Drop by http://www.zope.org/Members/alanpog/zmysqlda_steps and see what you did wrong.

    More Zope Articles
    More By icarus, (c) Melonfire


     

       

    ZOPE ARTICLES

    - Creating Zope Products
    - Plone Content Types With Archetypes
    - Flat User Management in Zope
    - Creating Basic Zope Applications
    - Getting started with Zope for Linux and Sola...
    - ZPT Basics (part 4)
    - ZPT Basics (part 3)
    - ZPT Basics (part 2)
    - ZPT Basics (part 1)
    - Exception Handling In DTML
    - DTML Basics (part 4)
    - DTML Basics (part 3)
    - DTML Basics (part 2)
    - DTML Basics (part 1)
    - Using Zope With Apache





    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway