Let SQLDocument display your RDBMS-Data

by Christian Klinger last modified Dec 06, 2009 09:27 PM
This Howto explains you the usage of SQLDocument. You will learn how you can easy add/edit/display RDBMS Data in Plone through Plone.

Get and install the software

To let SQLDocument access you data in your RDBMS you need to configure and install a "ZopeDatabase Connection".

In this example we will use a MySQL Database with ZMySQLDatabase Adapter.
(you can find it here http://sourceforge.net/project/showfiles.php?group_id=22307.)

If you need further help for installing and configuring your Database Adapter please look at the Relational Database Chapter in the Zope Book. http://www.plope.com/Books/2_7Edition/RelationalDatabases.stx#1-6


If you have your Zope Database Adapter running you have to install the SQLDocument.

Just put the package in your Products direcotry. You can find SQLDocument here http://www.plone.org/products/sqldocument. Or checkout form svn into your Products dir

 # svn co https://svn.plone.org/svn/collective/SQLDocument/trunk SQLDocument

Configuring (the ZMI-Part)

Add and configure your DatabaseConection through zope ZMI

Database Connection in ZMI














For our example we use the Table Adresse from the Database RedENet.
The table looks like these little example:

adresse_idP_KNR
P_STRASSE
P_PLZ
P_ORT
P_NAME1
P_NAME2
P_NAME3
P_HAUSNR
P_BV
132Kaiserstr90763
Fürth
Novareto
GMBH
CoKG
16
4
243
Schwabacherstr90764
Fürth
IM
Immobilien

22
5

Configuring (the Plone Part)

First install SQLDocument in the Quickinstaller.
Install SQLDocument in Quickinstaller


















If you get no errors during install. You should have SQLDocument as a new type to add in your Plone.


Make the first qury with SQLDocument

default - here you can edit gernaral things for SQLDocument

  1. The first step is add an SQLDocument anywhere in your portal.
  2. Now give your new SQLDocument a nice Title and Description.
  3. Now choose your Database-Connection ( you should see your DatabaseConnection )
  4. Add your sql-statement in the SQL field
  5. You can ignore the Pre Input Method (for now)
  6. Click next
fieldset - default




















SQL-Test - your sqlstatement is tested here

  1. check your sqlstatement.
  2. if you think everything is valid press next.
  3. if you see an error go back and edit your sqlstatement.


Look at the missing "r" in from
Note: You can not reach the next form until your sqlstatement is valid.
If you haven´t any error left change to the next form.


Settings -  here you can configure "displaying" options



Now press save and you will see your results.