[Zope-DB] Access database without ZSQL
Tue, 29 Oct 2002 12:22:50 +0000
On 2002-10-29 at 03:21:34 [+0000], you wrote:
> I'm new to Zope. Not sure whether it is possible to access a database
> without ZSQL in Zope.
Yes and no is the answer I think though someone else can explain it better
than me (and please correct me if/where I'm incorrect). One of the reasons
for using an application server is to be able to access databases through i=
you get connection pooling (apparently not wonderfully done in Zope,
transactions and caching all for free) ZSQL gives you a nice degree of
abstraction as well allowing you to change databases without too many chang=
to your code.
> I'm using PostgreSQL and Zope on Windows XP. I have successfully make a =
> Psycopg Database Connection in Zope.
> Whenever I run this script, the web browser prompt the authentication dia=
> ask for username and password. Did I do something wrong?
A PythonScript runs in a kind of sandbox: it only gets to see what Zope let=
it; you're trying to do something untrusted and possibly dangerous so I thi=
you've come up against the security system which is a *good thing* in my
opinion. I think you must call ZSQL within the script to access the databas=
ie. use a connection object. You can avoid this if you use an external meth=
I think which will run as a standard Python script.