[Zope3-Users] Guidance on accessing MySQL db.

Rich C madcubano1 at yahoo.com
Fri Mar 30 18:32:16 EDT 2007


Hello all,

I've just started using Zope 3 and am having some
difficulty finding examples on a good way to access a
MySQL database.  For the moment, I'd just like to be
able to read from the database and display it in a web
page with decent formatting. 

I've read examples from Zope 2 where they used a DTML
page that called a ZSQL method such as the following:

<dtml-in river_info>
    <dtml-var river_id>
    <dtml-var river_name>
</dtml-in>

ZSQL method would then contain:
SELECT river_id, river_name FROM river_info

In Zope 3, I only see an option to add a SQL script
which I'm pretty sure is not the same thing as a ZSQL
method since I've copied the above into a SQL script
and "Test"ing the script by itself does in fact read
from the MySQL database, but I can not access the SQL
script from a DTML page.  I get the following error:

"KeyError
A server error occurred."

So, some very basic questions :
What is the suggested way to access a MySQL database
from Zope 3.  

Should I even be creating DTML scripts, my
understanding was that there are better ways of doing
things than with DTML in Zope 3.  Basically, I just
want to be able to customize the displaying of whats
in the database.

On this list, there was a posting of someone creating
a content type to access the database.  Maybe this is
what I need to be doing.  Seems like a lot of
overhead, as compared to Zope 2.  

Here is a link to that thread:
http://mail.zope.org/pipermail/zope3-users/2006-February/002476.html

Basically, I'm looking for guidance/suggestions on the
right way to go about doing this.  Any help would be
greatly appreciated.

Thanks,
Rich



 
____________________________________________________________________________________
Bored stiff? Loosen up... 
Download and play hundreds of games for free on Yahoo! Games.
http://games.yahoo.com/games/front


More information about the Zope3-users mailing list