I came to this group today to see what I could find on a particular ZOPE/MySQL issue I'm having. It relates to this thread, somewhat. I hope someone can give me some insight.
I have ZOPE installed on a WIN98 machine that is acting as a temporary server until we go through a complete network upgrade to Windows 2000 Server, et. al. I have a development workstation that is using Windows 2000 Professional. This machine is where I have installed MySQL. So, I have ZOPE on one machine and MySQL on the other.
I installed the myODBC from mysql.com because I couldn't get any of the ZMySQLDA/MySQLdb products to work on any version of Windows (obviously it favors the Unix/Linux environment). Well, Windows is what I'm stuck with now.
I created databases, set up my ODBC connections, set up my Z SQL Methods and SQL Forms (depending upon which databases I access) and can access the databases with beautiful results on my ZOPE pages......BUT.....the results are extremellllllllllllllllllllly slow in coming. Even small databases with just a few records take forever to come up even with the most basic of SQL statements using either SQL Forms (for example, my Purchase Order database):
<dtml-var standard_html_header> <dtml-if CheckPermissions>
<dtml-unless REFERER><dtml-call "REQUEST.set ('REFERER',HTTP_REFERER)"></dtml-unless> <dtml-unless sqf_edit_method><dtml-call "REQUEST.set ('sqf_edit_method','edit')"></dtml-unless>
<h3>> <dtml-var title_or_id>: <dtml-var document_title> (List)</h3> <P> <a href="&dtml-URL2;/">Up</a> - <a href="&dtml-REFERER;">Back</a> - <a href="list?REFERER=&dtml-REFERER;">List</a> - <a href="add?REFERER=&dtml-REFERER;">Add</a>
<br><br>
<table CELLSPACING='&dtml-table_cell_spacing;'> <tr BGCOLOR='&dtml-internal_title_color;'> <th>P.O.#</th> <th>Order Date</th> <th>P.O. Vendor</th> <th>Items</th> <th>Terms</th> <th>Total</th> </tr>
<dtml-call "REQUEST.set('bat_size',_.int(viewlistlen))"> <dtml-unless start_key><dtml-call "REQUEST.set('start_key',0)"></dtml- unless> <dtml-if "_.int(start_key)<0"><dtml-call "REQUEST.set ('start_key',0)"></dtml-if> <dtml-call "REQUEST.set('next_key',_.int(start_key))">
<dtml-call "REQUEST.set('flag',0)">
<dtml-call "REQUEST.set('q','select * from po2002 where autoid
= '+_.str(start_key)+' order by autoid asc')">
<dtml-try> <dtml-in "SQL(q=q)" size=bat_size> <dtml-if "_.int(next_key) < _.int(autoid)"> <dtml-call "REQUEST.set('next_key',autoid)"> </dtml-if>
<tr valign="top" align="left" BGCOLOR='<dtml-if "_.int(flag) ==1">&dtml-internal_c1_color;<dtml-else>&dtml- internal_c2_color;</dtml-if>'>
<td><a href="&dtml-sqf_edit_method;?edit_key=<dtml-var autoid>&REFERER=&dtml-REFERER;"><dtml-var autoid></a></td> <td><dtml-var order_date></td> <td><dtml-var vendor_name></td> <td><dtml-var items></td> <td><dtml-var terms></td> <td><dtml-var total></td> </tr> <dtml-call "REQUEST.set('flag',1-_.int(flag))"> </dtml-in>
<dtml-except> <h1>General error</h1> <dtml-var errorinternalmethod> </dtml-try>
</table> <!-- navigation links --> <br> <a href="&dtml-URL0;?start_key=0&REFERER=&dtml-REFERER;">First</a> - <a href="&dtml-URL0;?start_key=<dtml-var "_.int(start_key)-_.int (bat_size)">&REFERER=&dtml-REFERER;">Prev</a> - <a href="&dtml-URL0;?start_key=<dtml-var "_.int (next_key)">&REFERER=&dtml-REFERER;">Next</a>
<dtml-else> <dtml-var standard_html_header> </dtml-if> <dtml-var standard_html_footer>
and then Z SQL Methods (for example, a document log database):
Example 1:
select * from yr2000
Example 2:
SELECT * FROM yr2000 WHERE doc_author='JEF'
I also tried to set up a search form so users can perform searches themselves instead of having to be limited to choosing from pre- constructed reports I provide them. It's daaaaaaaaaaaaaaawwwwwwwwwwwwwwwggggggggggggggg slowwwwwwwwwwwwwwwww though. I even went so far as to perform table structure tests on my MySQL databases to ensure I was optimizing them for the fastest performance. Any searches done through a MySQL client returns quick results but I want all of their access to these databases to be web- based (i.e., through ZOPE site). Help!
Thanks. Deb
--- In zope@yahoogroups.com, "Bryan Capitano" wrote:
There are several options to using Zope+MySQL on the same Windows
box. I
have not done this in a production server environment, so I can't
say how
well that would work. But for development purposes, it works just
fine.
I had some problems getting python-MySQL adapter to install on
Windows and
recognize my python installation (because I was trying to install
MySQLDA).
But there are two ways around this problem which I've learned: (1) One is to install MyODBC (see www.mysql.com) and create a
System ODBC
database for your MySQL database. Then install the MyODBCDA
database adapter
for Zope (instead of MySQLDA). This allows you to talk to MySQL
through an
ODBC bridge. This solution works like a charm. (2) The second workaround is to install Python2.1.3 on your machine separately from the Windows Zope installation. Then install the .exe Mysql-Python package (www.sourceforge.net). Then copy the installed
files to
the Zope/Python directory. Then install MySQLDa. This solution was
provided
to me by another list member (hiren_hindocha@a...).
-----Original Message----- From: zope-admin@z... [mailto:zope-admin@z...]On Behalf Of Greg & Janet LINDSTROM Sent: Saturday, November 02, 2002 7:41 AM To: zope@z... Subject: [Zope] Zope and MySQL on Windows
Greetings- I have a fairly mature Python application which uses MySQL for the
database.
I would like to switch over from a single machine application to a
web based
app (and maybe even make some money!!), and thought Zope would be
the
logical choice. The past 2 weeks have had me running through the
examples
in the Zope book and the Zope "Bible", and I *think* I am ready to
create a
project. Then I read the the creators of Zope do not reccommend
using MySQL
with Zope on a Windows box. Rats! So...
- Is this still sound advice?
- If so, what other Open Source Database is out there. I
really would
like data/time data types, so that would leave Gadfly out, right?
Plus. my
database is getting fairly large (~5 Meg), so I'm not sure I want
to load it
all in memory.
Thanks for any advice you can supply! Greg Lindstrom Vilonia, Arkansas
--------------------------------- Do you Yahoo!? Yahoo! News - Today's headlines
Deb B. wrote:
I installed the myODBC from mysql.com because I couldn't get any of the ZMySQLDA/MySQLdb products to work on any version of Windows (obviously it favors the Unix/Linux environment).
Nah, you should be using mysql-python and MySQLDA, both available from: http://sourceforge.net/projects/mysql-python
I've had them both working fine on windows so if you run into problems I may be able to help...
Well, Windows is what I'm stuck with now.
unlucky ;-)
<dtml-unless REFERER><dtml-call "REQUEST.set ('REFERER',HTTP_REFERER)"></dtml-unless> <dtml-unless sqf_edit_method><dtml-call "REQUEST.set ('sqf_edit_method','edit')"></dtml-unless>
This is horrible, please think about using ZPT and Python Scripts. It's a shame you're lumbered with DTML for ZSQL Methods, but maybe one day someone will have that for the better!
cheers,
Chris
Thanks for your response Chris. I would appreciate ANY assistance with the installation of these products. I've had them downloaded for quite a while but because I'm no programmer I couldn't figure out how to install them on Windows with express instructions...which the author didn't provide. Do you or anyone else have instructions for installing on Windows which is geared toward the non-programmer? I can figure most things out myself, but this one eluded me.... Thanks for any help you/anyone can offer. Chris Withers chrisw@nipltd.com wrote:Deb B. wrote:
I installed the myODBC from mysql.com because I couldn't get any of the ZMySQLDA/MySQLdb products to work on any version of Windows (obviously it favors the Unix/Linux environment).
Nah, you should be using mysql-python and MySQLDA, both available from: http://sourceforge.net/projects/mysql-python
I've had them both working fine on windows so if you run into problems I may be able to help...
Well, Windows is what I'm stuck with now.
unlucky ;-)
This is horrible, please think about using ZPT and Python Scripts. It's a shame you're lumbered with DTML for ZSQL Methods, but maybe one day someone will have that for the better!
cheers,
Chris
_______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
--------------------------------- Do you Yahoo!? Yahoo! News - Today's headlines
Deb B. wrote:
Thanks for your response Chris. I would appreciate ANY assistance with the installation of these products. I've had them downloaded for quite a while but because I'm no programmer I couldn't figure out how to install them on Windows with express instructions...which the author didn't provide. Do you or anyone else have instructions for installing on Windows which is geared toward the non-programmer? I can figure most things out myself, but this one eluded me....
It's really not that hard.
IIRC,
Install Python 2.1 Have a look in Use the MySQL-python windows installer. This will want to install into the Python 2.1 you just installed, that's the only reason you installed it ;-) Copy anything that has mysql in it's name from C:\Python21\lib (or whether you put Python21+'\lib') to lib\python of you Zope install. For me, thsi was: _mysql.pyd _mysql_exceptions.py MySQLdb (a folder) Now unpack ZMySQLDA.tgz into your Zope Products folder. Restart Zope.
All done.
Chris
I am going through the documentation for MySQL-python and aren't there a few more steps to the installation? Don't I have to edit the setup.py file for:
#!/usr/bin/env python
"""Setup script for the MySQLdb module distribution."""
import os, sys
from distutils.core import setup
from distutils.extension import Extension
import string
YES = 1
NO = 0
# set this to YES if you have the thread-safe mysqlclient library
thread_safe_library = YES
# You probably don't have to do anything past this point. If you
# do, please mail me the configuration for your platform. Don't
# forget to include the value of sys.platform and os.name.
and the following additional sections within the setup.py file:
if sys.platform == "netbsd1":
include_dirs = ['/usr/pkg/include/mysql']
library_dirs = ['/usr/pkg/lib/mysql']
and:
elif os.name == "posix": # UNIX-ish platforms not covered above
pass # default should work
or does the Windows installer that you mention take care of these settings? I somewhat doubt it because all of the author's instructions assume Linux/Unix/*ix throughout his instructions. Furthermore, which file or set of files within MYSQL-python are the Windows installer files? And what about the settings in the setup.cfg file? Do these need to be modified for Windows installations?:
[bdist_rpm]
doc_files = README doc/*.?tml CHANGELOG
vendor = MySQL-python SourceForge Project
packager = Andy Dustman andy@dustman.net
distribution-name = Red Hat Linux
requires = python
build-requires = python-devel mysql-devel zlib-devel
In the author's docs he states:Windows (3.11, 95, 98, NT, 2000, CE, BSOD, XYZ, etc.) Windows is not a supported platform. However, the setup.py script reportedly gets the job done. There is probably a link on the web page for getting a precompiled Windows installer from someone or other. Be aware that this is a user-contributed package; the author cannot help you with compiling and running under Windows.
and I ask: Precompiled Windows installer? Where? What for (python? MYSQL-python?)? Excuse my ignorance, but I can't second guess the settings he is requiring before setup.py or setup.cfg (or whatever other files) will render a successful installation of the MYSQL-python product. I'd really love to be able to get this installed along with the mysqlda/db product so that I can get my web-based interfaces to mysql databases to perform better (faster) but the lack of "explicit" instructions for this non-programmer makes it very difficult. Without being a bother, can I get more "detail" in your instructions? Thanks a bunch! Chris Withers chrisw@nipltd.com wrote:Install Python 2.1 Have a look in Use the MySQL-python windows installer. This will want to install into the Python 2.1 you just installed, that's the only reason you installed it ;-) Copy anything that has mysql in it's name from C:\Python21\lib (or whether you put Python21+'\lib') to lib\python of you Zope install. For me, thsi was: _mysql.pyd _mysql_exceptions.py MySQLdb (a folder) Now unpack ZMySQLDA.tgz into your Zope Products folder. Restart Zope.
All done.
Chris
--------------------------------- Do you Yahoo!? Yahoo! Mail Plus - Powerful. Affordable. Sign up now
Deb B. wrote:
I am going through the documentation for MySQL-python and aren't there a few more steps to the installation?
I didn't do anything special and it worked for me... Dunno why you're looking at setup.py if you're using the binary installer.
Chris
Well, I installed MySQL-python 0.9.1 (because I'm running Python 2.1.x with my Zope installation) and extracted the ZMySQLDA into the products directory and for the ZMySQLDA product (which is broken), I get the following error: Product at /Control_Panel/Products/ZMySQLDA Import Traceback Traceback (most recent call last): File "D:\IntranetSite\lib\python\OFS\Application.py", line 531, in import_product product=__import__(pname, global_dict, global_dict, silly) File "D:\IntranetSite\lib\python\Products\ZMySQLDA__init__.py", line 91, in ? import DA File "D:\IntranetSite\lib\python\Products\ZMySQLDA\DA.py", line 92, in ? from db import DB File "D:\IntranetSite\lib\python\Products\ZMySQLDA\db.py", line 99, in ? from MySQLdb.converters import conversionsImportError: No module named MySQLdb.converters
This is the problem I recall encountering when I attempted these installs several weeks ago and gave up. Now, it should be noted that during the MySQL-python install, it did find an existence of Python 2.1 in the registry BUT wouldn't let me indicate an installation directory (that field was grayed out). I accepted the default (whatever that is) and continued the installation. My ZOPE installation is on DRIVE D: and not C: on a W98 computer (interim solution until the new server comes). Does this make any difference or have any impact on ZMySQLDA not finding the MySQLdb.converters module? How do I fix this installation...? Thanks.
Chris Withers chrisw@nipltd.com wrote:Deb B. wrote:
I am going through the documentation for MySQL-python and aren't there a few more steps to the installation?
I didn't do anything special and it worked for me... Dunno why you're looking at setup.py if you're using the binary installer.
Chris
--------------------------------- Do you Yahoo!? Yahoo! Mail Plus - Powerful. Affordable. Sign up now
Well, I installed MySQL-python 0.9.1 (because I'm running Python 2.1.x with my Zope installation) and extracted the ZMySQLDA into the products directory and for the ZMySQLDA product (which is broken), I get the following error: Product at /Control_Panel/Products/ZMySQLDA Import Traceback Traceback (most recent call last): File "D:\IntranetSite\lib\python\OFS\Application.py", line 531, in import_product product=__import__(pname, global_dict, global_dict, silly) File "D:\IntranetSite\lib\python\Products\ZMySQLDA__init__.py", line 91, in ? import DA File "D:\IntranetSite\lib\python\Products\ZMySQLDA\DA.py", line 92, in ? from db import DB File "D:\IntranetSite\lib\python\Products\ZMySQLDA\db.py", line 99, in ? from MySQLdb.converters import conversionsImportError: No module named MySQLdb.converters
This is the problem I recall encountering when I attempted these installs several weeks ago and gave up. Now, it should be noted that during the MySQL-python install, it did find an existence of Python 2.1 in the registry BUT wouldn't let me indicate an installation directory (that field was grayed out). I accepted the default (whatever that is) and continued the installation. My ZOPE installation is on DRIVE D: and not C: on a W98 computer (interim solution until the new server comes). Does this make any difference or have any impact on ZMySQLDA not finding the MySQLdb.converters module? How do I fix this installation...? Thanks.
Chris Withers chrisw@nipltd.com wrote:Deb B. wrote:
I am going through the documentation for MySQL-python and aren't there a few more steps to the installation?
I didn't do anything special and it worked for me... Dunno why you're looking at setup.py if you're using the binary installer.
Chris
--------------------------------- Do you Yahoo!? Yahoo! Mail Plus - Powerful. Affordable. Sign up now
[don't post in HTML]
Deb B. wrote:
File "D:\IntranetSite\lib\python\Products\ZMySQLDA\db.py", line 99, in ? from MySQLdb.converters import conversions ImportError: No module named MySQLdb.converters
Did you copy all of the mysql stuff from C:\Python21\lib as I described?
cheers,
Chris
From: Deb B. Thanks for your response Chris. I would appreciate ANY assistance with the
installation of these products. I've had
them downloaded for quite a while but because I'm no programmer I couldn't
figure out how to install them on
Windows with express instructions...which the author didn't provide. Do you
or anyone else have instructions
for installing on Windows which is geared toward the non-programmer? I can
figure most things out myself,
but this one eluded me.... Thanks for any help you/anyone can offer.
Here's something I accidentally posted off-list to someone doing this sort of thing, but I reckon I should rectify this.
There was only one brick wall I came across when installing 'MySQL for Python' in order to use MySQL with Zope.
After having installed zope and MySQL, I tried to install MySQL for Python, but when it asked for the directory to install to there was no way to enter anything. I finally found the following message from http://sourceforge.net/forum/forum.php?thread_id=621106&forum_id=70461
which provides a fix.
" By: locquet ( Bertrand LOCQUET ) RE: Install Win32 Pythonware Distro 2002-10-03 07:36 I found a solution Before installing MySQL-python-0.9.2.win32-py2.1.exe Just add an entry to you register base : [HKEY_LOCAL_MACHINE\SOFTWARE\Python\PythonCore\2.1\InstallPath] @="C:\Program Files\WebSite\bin"
Replace the default value @= with the path to you python.exe installed with Zope.
Then run the MySQL-python installation and select the entry. It works well ;-) "
The alternative is to install Python separately, then install MySQL for Python and copy the files over. I reckon that's more pain so I didn't do it.
The ZMySQLDA (which is also required) was an easy install.