Mailing List Archive

Basic Zope-DB question
Hi *,
I'm developing a FS based product with Zope, and I need to fetch some data from a DB (SQLServer).
I've installed the DA, got a connection, now I need to query the db from within my product.
I've searched the web for documentation, but didn't find the information I'm searching. From what I understand I have to acquire the connection from Zope, but I don't know how.

TIA
ngw


---------------------------------
Yahoo! Mail: gratis 1GB per i messaggi, antispam, antivirus, POP3
Re: Basic Zope-DB question [ In reply to ]
--On 21. Juli 2005 15:17:49 +0200 Nicholas Wieland
<nicholas_wieland@yahoo.it> wrote:

> Hi *,
> I'm developing a FS based product with Zope, and I need to fetch some
> data from a DB (SQLServer). I've installed the DA, got a connection, now
> I need to query the db from within my product. I've searched the web for
> documentation, but didn't find the information I'm searching. From what I
> understand I have to acquire the connection from Zope, but I don't know
> how.

You should read the RDBMS chapter of The Zope Book. It explains everything
carefully, doesn't it?

-aj
RE: Basic Zope-DB question [ In reply to ]
let's say your DA 'instance' is located at /Database/cx1

In your FS Product code, you'd probably be able to get your hands on it
like this: self.Database.cx1

(This makes some very broad assumptions about how your Product is
structured, but hopefully it's a start for you)


Personally I think it's easier, as long as you're in an FS-based
Product, to deal directly with whatever database interface (bypassing
its Zope adapter and Zope's transaction machinery). The thing you
either lose or gain by doing this (it depends what your goals are): you
have to handle RDBMS transactions 'manually'.


hth
Jim



_____

From: zope-db-bounces@zope.org [mailto:zope-db-bounces@zope.org]
On Behalf Of Nicholas Wieland
Sent: Thursday, July 21, 2005 9:18 AM
To: zope-db@zope.org
Subject: [Zope-DB] Basic Zope-DB question


Hi *,
I'm developing a FS based product with Zope, and I need to
fetch some data from a DB (SQLServer).
I've installed the DA, got a connection, now I need to query the
db from within my product.
I've searched the web for documentation, but didn't find the
information I'm searching. From what I understand I have to acquire the
connection from Zope, but I don't know how.

TIA
ngw


_____

Yahoo! Mail
<http://us.rd.yahoo.com/mail_it/taglines/*http://it.mail.yahoo.com> :
gratis 1GB per i messaggi, antispam, antivirus, POP3
Re: Basic Zope-DB question [ In reply to ]
It seems to me that it doesn't even nominate Products.ZSQLMethods.SQL or filesystem based products ...
Maybe I'm missing the interesting bits...

ngw

ps sorry for top-posting: it's yahoo webmail :(

Andreas Jung <lists@andreas-jung.com> ha scritto:


--On 21. Juli 2005 15:17:49 +0200 Nicholas Wieland
wrote:

> Hi *,
> I'm developing a FS based product with Zope, and I need to fetch some
> data from a DB (SQLServer). I've installed the DA, got a connection, now
> I need to query the db from within my product. I've searched the web for
> documentation, but didn't find the information I'm searching. From what I
> understand I have to acquire the connection from Zope, but I don't know
> how.

You should read the RDBMS chapter of The Zope Book. It explains everything
carefully, doesn't it?

-aj




---------------------------------
Yahoo! Mail: gratis 1GB per i messaggi, antispam, antivirus, POP3
Re: Basic Zope-DB question [ In reply to ]
--On 21. Juli 2005 15:53:13 +0200 Nicholas Wieland
<nicholas_wieland@yahoo.it> wrote:

> It seems to me that it doesn't even nominate Products.ZSQLMethods.SQL or
> filesystem based products ... Maybe I'm missing the interesting bits...
>

This comment raises the assumption that you have not understand the basics
of Zope yet. ZSQL instances are *objects* that can be called from
*everywhere* in Zope (ZPT, DTML, PythonScript, Product code or whatever).
It does not matter from where you call them. ZSQL methods like any other
object has an API that can be used from any everywhere in Zope (general
speaking).

-aj