List:General Discussion« Previous MessageNext Message »
From:Eric Maryniak Date:August 2 2000 10:14am
Subject:Zope MySQL DA (Database Adapter) installation howto
(step-by-step) under SuSE Linux 6.3/6.4
View as plain text  
Hello list,

If you are running Zope (www.zope.org) on SuSE Linux 6.3/6.4 and want
to use Zope's MySQL DA (database adapter), here's a small step-by-step
howto, because I had to grab together some docu on the Zope site and
there were some installation thingies that weren't too obvious.

Necessary precondition is of course that you are running Zope --- a
detailed step-by-step procedure on how to install Zope on _SuSE_
Linux can be found at:

    http://www.zope.org/Members/maryniak/zope-on-suse64-howto/

(other distro's, like RedHat, have ready-to-go rpm's).

Then, in order to use SQL from Zope to MySQL, install the MySQL
database adapter, as described below.

Good luck! Bye-bye, Eric
====
o MySQL database access via Zope.
  Installing the Zope MySQL Database Adapter (ZMySQLDA), version 1.2.0
  or newer (which includes MySQLdb 0.1.2 or newer).
  ZMySQLDA url:

      http://www.zope.org/Members/mordred/ZMySQLDA/

  Verify that Python >= 1.5.2 is installed, MySQL and the MySQL libraries
  (which must be locatable by ld) version 3.22.11 or higher:

      # rpm -qa | egrep -i '(python|mysqldev)'

        python-1.5.2-40
        mysqldev-3.22.30-0

      # ldconfig -p | grep -i mysql

        libmysqlclient.so.6 (libc6) => /usr/lib/libmysqlclient.so.6
        libmysqlclient.so (libc6) => /usr/lib/libmysqlclient.so

  Download 'ZMySQLDA-1.2.0.tar.gz' to /usr/src/packages/SOURCES/ and
  unpack it in the Zope top-level directory:

      # cd /opt/zope
      # tar zxvf /usr/src/packages/SOURCES/ZMySQLDA-1.2.0.tar.gz

  Fix ownership and permissions:

      # chown -R root:root /opt/zope/lib/python/Products/ZMySQLDA/.
      # chmod -R og-w      /opt/zope/lib/python/Products/ZMySQLDA/.
  
  Verify that there are no setuid or setgid files (always a safe
  precaution):

      # find /opt/zope \
             -type f \( -perm -04000 -o -perm -02000 \) -exec ls -lg {} \;

  Go to the MySQLdb-0.1.2 sub-directory:

      # cd /opt/zope/lib/python/Products/ZMySQLDA/MySQLdb-0.1.2

  Make a copy and then edit the file 'Setup.in':

      # cp -pv Setup.in Setup.in.orig

  change the one (1) line with -L and -I flags to:

      _mysql _mysqlmodule.c -L/usr/lib -I/usr/include/mysql -lmysqlclient

  Next build the ZMySQLDA product, while still in the MySQLdb sub-directory
  '/opt/zope/lib/python/Products/ZMySQLDA/MySQLdb-0.1.2':

      # python build.py

  And install:

      # make install
      # cp -pv MySQLdb.py{,c,o} /usr/lib/python1.5/site-packages

  Finally, restart Zope:

      # rczope restart

  Now you can make a ZMySQL connection.
  Inside a Folder, add a 'ZMySQL Database Connection' Item.
  The "connection string" looks like:

      database[@host] user passwd

  For the Client database user client_db_readonly@localhost, this becomes
  (replace XXXXXXXX with the real password of client_db_readonly):

      client@localhost client_db_readonly XXXXXXXX

  Go to the 'Test' tab, enter this query and then 'Submit Query':

      SELECT client.name, client.order FROM client;

  You should get a table.
====
-- 
Eric Maryniak <e.maryniak@stripped>
Home page: http://pobox.com/~e.maryniak/
University of Amsterdam, Department of Psychology.
Tel/Fax: +31 20 5256853/6391656. Internet: http://www.neuromod.org/

From "15 reasons why Star Trek is better than the X-Files":

  12. No one in Star Trek can be accused of not getting out enough.


Thread
Zope MySQL DA (Database Adapter) installation howto(step-by-step) under SuSE Linux 6.3/6.4Eric Maryniak2 Aug