Connection to MySQL in zope product
Hi, I plan to develop a product that make use of external database (MySQL). I tried to get some reference on this in internet, but to no avail. How can i do this?. I understand that with python script or dtml we need to create database connection object, and zsql method. But how do we do it from product class?. If i can get some point of reference from the net, it would be good. Thanks. __________________________________ Do you Yahoo!? Yahoo! Small Business - Try our new resources site! http://smallbusiness.yahoo.com/resources/
--On Sonntag, 13. März 2005 19:11 Uhr -0800 bahriesz@yahoo.com wrote:
Hi,
I plan to develop a product that make use of external database (MySQL). I tried to get some reference on this in internet, but to no avail. How can i do this?.
I understand that with python script or dtml we need to create database connection object, and zsql method. But how do we do it from product class?.
You have not read the RDBMS chapter of the Zope Book (-> zope.org -> The Zope Book). -aj
--On Sonntag, 13. März 2005 19:11 Uhr -0800 bahriesz@yahoo.com wrote:
Hi,
I plan to develop a product that make use of external database (MySQL). I tried to get some reference on this in internet, but to no avail. How can i do this?.
I understand that with python script or dtml we need to create database connection object, and zsql method. But how do we do it from product class?.
For a CMF or Plone project you can put your ZSQL methods into a skins folder (as files *.zsql). They are recognized automatically a ZSQL methods and be be re-used through the standard acquistion magic as any other method. Creating ZSQL methods as methods of a Zope product is somewhat un-common but it can be done afaik by instantiating ZSQL methods (using their API which can be found from the sources). -aj
Andreas Jung wrote:
--On Sonntag, 13. März 2005 19:11 Uhr -0800 bahriesz@yahoo.com wrote:
Hi,
I plan to develop a product that make use of external database (MySQL). I tried to get some reference on this in internet, but to no avail. How can i do this?.
I understand that with python script or dtml we need to create database connection object, and zsql method. But how do we do it from product class?.
For a CMF or Plone project you can put your ZSQL methods into a skins folder (as files *.zsql). They are recognized automatically a ZSQL methods and be be re-used through the standard acquistion magic as any other method. Creating ZSQL methods as methods of a Zope product is somewhat un-common but it can be done afaik by instantiating ZSQL methods (using their API which can be found from the sources).
See for some help with this http://www.zope.org/Members/jccooper/extzsql --jcc
bahriesz@yahoo.com wrote:
Hi,
I plan to develop a product that make use of external database (MySQL). I tried to get some reference on this in internet, but to no avail. How can i do this?.
I understand that with python script or dtml we need to create database connection object, and zsql method. But how do we do it from product class?.
If i can get some point of reference from the net, it would be good.
Thanks.
What you could do inside your product is: from Products.ZSQLMethods.SQL import SQL class MyProduct(SimpleItem): a_query = SQL('aQuery', 'a query', 'a_db_connection', 'param1' """ SELECT * FROM data WHERE <dtml-sqltest param1 op="eq" type="string"> """) ... def my_method(self): result = self.a_query(param1='a param1') .... Regards Marco
participants (4)
-
Andreas Jung -
bahriesz@yahoo.com -
J Cameron Cooper -
Marco Bizzarri