I didn't test this, but maybe you can define in your
/etc/qpsmtpd/db_base instead of a local socket connection:

driver   = mysql
database = maildb

a remote tcp connection:

driver   = mysql
database = mai...@some-where-else.de:3306

or more verbose:

driver   = mysql
database = database=maildb;host=some-where-else.de;port=3306

The config values are used in the call to DBI->connect ( sub db_connect
in db/common) for the datasource parameter like this:

'DBI:' . $config->{driver} . ':' . $config->{database}

So you might use a remote connection or even another database.

See also http://www.perlmonks.org/?node_id=606334

Ernesto


Am 11.01.2010 14:40 schrieb Stefan Priebe:
> Oh thanks - but if you use TCP instead of Sockets this should work?
> 
> Stefan
> 
> Ernesto schrieb:
>> Am 11.01.2010 13:25 schrieb Stefan Priebe:
>>> I would like to do the auth and rcpt_ok via MySQL. Is there a good way
>>> to share the DB Connection? Or do i have to connect to MySQL for each
>>> query? If there is a way - where to store the dbh Handle - so that all
>>> childs can use it?
>>>
>> Hi Stefan,
>>
>> you should keep the DB connection for a single SMTP request only - I had
>> to learn this myself: See the discussion on
>> http://www.nntp.perl.org/group/perl.qpsmtpd/2007/08/msg7144.html
>>
>> And please have a look at my db/suite - where the DBI connection is
>> stored in $qp->connection->notes()
>>
>> On
>> http://dienstleistung-kultur.de/qpsmtpd/db_common.shtml#inheritance
>> you'll find a skeleton for an own plugin inheriting from db/common,
>> which provides all the database handling stuff.
>>
>> Just say in /etc/qpsmtpd/plugins
>>
>>     db/base
>>     db/your_plugin
>>
>> and in db/your_plugin you can easily access your database defined in
>> /etc/qpsmtpd/db_base via the methods provided by db/common.
>>
>> db/suite runs on our server in production on QPSMTPD forkserver 0.32 in
>> combination with Exim 4.63, MySQL 5.0.32 and Dovecot 1.0rc15 on Debian
>> Etch - never change a running system ;-)
>>
>> Please see http://dienstleistung-kultur.de/qpsmtpd/
>>
>> Sincerely,
>> Ernesto
>>
> 

-- 
______________________________________________________________________

Dienstleistung Kultur Ltd. & Co. KG
Lützenstr. 10, 10711 Berlin           Telephon +49-(0)30 - 89 09 56 59
Prokurist Ernst-J. Johnsdorf         Faksimile +49-(0)30 - 89 09 56 60
HRA 41207 Berlin-Charlottenburg        http://dienstleistung-kultur.de
USt-IdNr. DE 261 999 858          mailto:m...@dienstleistung-kultur.de
______________________________________________________________________

Dienstleistung Kultur Ltd.      27, Gloucester Street, London WC1N 3AX
Companies House, Cardiff, No. 6512436           Director Ute-I. Pehlke
______________________________________________________________________


Reply via email to