[Zope] database connections in a multi-Zope zeo environment

Dieter Maurer dieter at handshake.de
Mon Aug 15 13:20:55 EDT 2005


Dennis Allison wrote at 2005-8-14 14:11 -0700:
> ...
>1.  When I open a database connection with the connection string
>
>	-u dbroot -h  localhost -passwd mypassword
>
>what machine is accessed?  I'm presuming localhost is always the local
>machine.  Is that correct?

If not, the name "localhost" were an extremely bad choice:

  You (or more likely your system administrator) are free
  to map the name "localhost" to whatever IP address you
  like.

  But, if you decide to map it to anything different than
  your local host, you are worth the confusion you will get....

>2.  How do I open a remote database connection so it works transparently 
>across multiple instances of Zope?  The Zope code, shared across 
>instances, uses a single connection with a connection string like
>
>	-u dbroot -h 192.168.0.3 -passwd somepassword

Why do you ask us?

These questions concern the meaning of MySQL connection strings
and have nothing to do with Zope.

I assume that the options in these connection strings
were well chosen: then "-h" means "host".
This would mean the connection described by the above string
is to host "192.168.0.3" (it usually is better to use names
rather than IP addresses).

>Presumably each of the remote machines (and the database server if it 
>runs Zope) needs an entry in the grant table.

Yes, if that is necessary that MySQL grants access....

> And all the database 
>connections need to share the same password.  Right?

If they use the same object (in the same ZEO), then the connection string
is identical across all ZEO clients.

If they use different objects, the connection strings can vary

>3.  Since queries are bound to their connection, there appears to be no 
>easy way to manage connections in a simple way programmatically.   

What?

What has the management of connections (which Zope does automatically for
you) has to do with the binding of queries to connections?

-- 
Dieter


More information about the Zope mailing list