Re: [exim] Different MySQL connections for different jobs

Page principale
Supprimer ce message
Répondre à ce message
Auteur: W B Hacker
Date:  
À: exim-users
Sujet: Re: [exim] Different MySQL connections for different jobs
Philip Hazel wrote:
> On Tue, 5 Sep 2006, Mike Cardwell wrote:
>
>
>>I nice solution would be for you to be able to do:
>>
>>hide mysql_servers = named_database1=localhost/dbname1/dbuser1/dbpass1: \
>>                     named_database2=otherhost/dbname2/dbuser2/dbpass2

>>
>>And then name your database in the lookup:
>>
>>${lookup mysql{named_database1}{THE QUERY}{$value}}
>
>
> In MySQL, you can name the database in the query, but you can't name the
> server. Doing something like what you have suggested is actually quite
> complicated because it would impinge on the query caching. More and more
> I feel that the best solution for Exim is to have some kind of SQL proxy
> daemon that takes the complexity out of Exim itself.
>
>
>


The server queried doesn't know or care what caused the access, so long as it
arrives on the right doorstep with the correct credentials.

http://exim.org/exim-html-4.62/doc/html/spec_html/ch09.html#id2546221

Says, in part;

====

"... Here is an example where two MySQL servers are listed:

hide mysql_servers = localhost/users/root/secret:\
                      otherhost/users/root/othersecret


For MySQL and PostgreSQL, a host may be specified as <name>:<port> but because
this is a colon-separated list, the colon has to be doubled. For each query,
these parameter groups are tried in order until a connection and a query succeeds."

====

FWIW, the socket equivalent we use needs parentheses, and we specify the table
as well as the DB - the format is:

hide pgsql_servers =

(/<directory>/<socketname>)/<dbname>/<tablename>/<username>/<password>

Apologies, Philip. You told us what we needed all along....

;-)

Bill