You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@spamassassin.apache.org by Michael Monnerie <mi...@it-management.at> on 2006/06/18 01:37:35 UTC
SQL Bayes with Postgres in SUSE9.3
Hello, I'm wondering why I need different settings than written anywhere
in the documentation. For the first time I tried to use bayes via SQL,
and read the README and the wiki. They suggest this in local.cf:
bayes_store_module Mail::SpamAssassin::BayesStore::PgSQL
bayes_sql_dsn DBI:driver:database:hostname[:port]
bayes_sql_username dbusername
bayes_sql_password dbpassword
(and optionally:)
bayes_sql_override_username someusername
But that didn't work for me, I had to use:
bayes_store_module Mail::SpamAssassin::BayesStore::PgSQL
bayes_sql_dsn DBI:Pg:dbname=spamass;host=localhost
bayes_sql_username dbusername
bayes_sql_password dbpassword
bayes_sql_override_username vscan
So my DSN had to contain "dbname=" and "host=", separated via semicolon.
That seems to be because of my version of DBD::Pg, which is
perl-DBD-Pg-1.22-199 (rpm by SUSE9.3).
The next itch after this was, that I couldn't start spamd, because user
vscan was not defined. After one
insert into bayes_vars (username) values ('vscan');
everything seems to work now.
But I'm still wondering why the documentation differs from my
experience?
mfg zmi
--
// Michael Monnerie, Ing.BSc ----- http://it-management.at
// Tel: 0660/4156531 .network.your.ideas.
// PGP Key: "curl -s http://zmi.at/zmi3.asc | gpg --import"
// Fingerprint: 44A3 C1EC B71E C71A B4C2 9AA6 C818 847C 55CB A4EE
// Keyserver: www.keyserver.net Key-ID: 0x55CBA4EE
Re: SQL Bayes with Postgres in SUSE9.3
Posted by Michael Monnerie <mi...@it-management.at>.
On Sonntag, 18. Juni 2006 01:37 Michael Monnerie wrote:
> Hello, I'm wondering why I need different settings than written
> anywhere in the documentation. For the first time I tried to use
> bayes via SQL, and read the README and the wiki. They suggest this in
> local.cf:
>
> bayes_store_module
> Mail::SpamAssassin::BayesStore::PgSQL bayes_sql_dsn
> DBI:driver:database:hostname[:port] bayes_sql_username
> dbusername
> bayes_sql_password dbpassword
> (and optionally:)
> bayes_sql_override_username someusername
Sorry, forgot to post the errors from spamd:
[21920] dbg: bayes: unable to connect to database: missing "=" after
"zmi_sa_bayes:localhost" in connection info string
[21920] dbg: bayes: unable to connect to database: missing "=" after
"zmi_sa_bayes:localhost" in connection info string
> The next itch after this was, that I couldn't start spamd, because
> user vscan was not defined. After one
> insert into bayes_vars (username) values ('vscan');
> everything seems to work now.
Errors here:
[2322] dbg: bayes: using username: vscan
[2322] dbg: bayes: database connection established
[2322] dbg: bayes: found bayes db version 3
[2322] dbg: bayes: unable to initialize READONLY database for vscan
user, aborting!
[2322] dbg: bayes: database connection established
[2322] dbg: bayes: found bayes db version 3
[2322] dbg: bayes: unable to initialize READONLY database for vscan
user, aborting!
Note that the word "READONLY" was set by me in
lib/Mail/SpamAssassin/BayesStore/SQL.pm line 141, because it was the
same message than in the function where the DB was NOT readonly. I just
wanted to know where the code was jumping around...
Ah yes, it's SA 3.1.3.
mfg zmi
--
// Michael Monnerie, Ing.BSc ----- http://it-management.at
// Tel: 0660/4156531 .network.your.ideas.
// PGP Key: "curl -s http://zmi.at/zmi3.asc | gpg --import"
// Fingerprint: 44A3 C1EC B71E C71A B4C2 9AA6 C818 847C 55CB A4EE
// Keyserver: www.keyserver.net Key-ID: 0x55CBA4EE
Re: SQL Bayes with Postgres in SUSE9.3
Posted by Michael Parker <pa...@pobox.com>.
Michael Monnerie wrote:
>
> I would say the docs are not correct, at least to one who is not
> specialist in configuring DBI. I found the info on the DBI man page,
> but still the docs here are wrong.
You are not reading completely, especially the part that says:
"For an example of connection to PostgreSQL, see the main README file."
Which provides the exact information you are looking for.
But like I said, its open source, if anyone feels that the documentation
could use a little more information, then they are free to provide patches.
Michael
Re: SQL Bayes with Postgres in SUSE9.3
Posted by Michael Monnerie <mi...@it-management.at>.
On Donnerstag, 22. Juni 2006 15:15 Michael Parker wrote:
> Actually, please re-read the sql/README.bayes file, it specifies
> where to find the connection string stuff for Pg.
Yes I did. It reads:
bayes_sql_dsn DBI:driver:database:hostname[:port]
bayes_sql_username dbusername
bayes_sql_password dbpassword
The bayes_sql_dsn directive describes the data source name that will
be used to create the connection to your SQL server. It MUST be in
the format as listed above. <driver> should be the DBD driver that
you have installed to access your database (initially tested with
MySQL, PostgreSQL, and SQLite). <database> must be the name of the
database that you created to store the bayes data tables. <hostname>
is the name of the host that contains the SQL database server.
<port> is the optional port number where your database server is
listening.
Especially "It MUST be in the format as listed above" doesn't fit. If
you read my initial mail with the errors, I showed log info:
[21920] dbg: bayes: unable to connect to database: missing "=" after
"zmi_sa_bayes:localhost" in connection info string
This was with
bayes_sql_dsn DBI:Pg:zmi_sa_bayes:localhost
and works with
bayes_sql_dsn DBI:Pg:dbname=zmi_sa_bayes;host=localhost
I would say the docs are not correct, at least to one who is not
specialist in configuring DBI. I found the info on the DBI man page,
but still the docs here are wrong.
If you like, I'll make changes on that wiki page(s), but I'm not sure I
do everything correct either. :-)
mfg zmi
--
// Michael Monnerie, Ing.BSc ----- http://it-management.at
// Tel: 0660/4156531 .network.your.ideas.
// PGP Key: "curl -s http://zmi.at/zmi3.asc | gpg --import"
// Fingerprint: 44A3 C1EC B71E C71A B4C2 9AA6 C818 847C 55CB A4EE
// Keyserver: www.keyserver.net Key-ID: 0x55CBA4EE
Re: SQL Bayes with Postgres in SUSE9.3
Posted by Michael Parker <pa...@pobox.com>.
Michael Monnerie wrote:
> On Donnerstag, 22. Juni 2006 02:35 Mark Martinec wrote:
>> On Thursday June 22 2006 01:25, Michael Monnerie wrote:
>>> On Sonntag, 18. Juni 2006 01:37 Michael Monnerie wrote:
>>>> So my DSN had to contain "dbname=" and "host=", separated via
>>>> semicolon.
>>> Nobody of the devs got anything to say on that? I'm not sure if I
>>> did everything correct (at least it works now), at least the
>>> documentation is not correct/misleading/strange.
>> Semicolon is a usual separator between components of dsn in
>> DBI::connect.
>>
>> See man page of a Perl module DBI, among others it says
>
> Yes, but I was referring to the wiki:
>
> http://wiki.apache.org/spamassassin/BetterDocumentation/SqlReadmeBayes?highlight=%28sql%29
>
> http://wiki.apache.org/spamassassin/UsingSQL?highlight=%28sql%29
>
> Both pages do not refer to that, it could be improved. I would do it,
> but don't really have knowledge about this issue. So I was hoping
> somebody would step up - there maybe others relying on that pages.
>
> mfg zmi
Actually, please re-read the sql/README.bayes file, it specifies where
to find the connection string stuff for Pg.
All of the information is there. If you'd like to improve on the
documentation, well one page is a wiki page and the other, I would
kindly accept patches for.
Michael
Re: SQL Bayes with Postgres in SUSE9.3
Posted by Michael Monnerie <mi...@it-management.at>.
On Donnerstag, 22. Juni 2006 02:35 Mark Martinec wrote:
> On Thursday June 22 2006 01:25, Michael Monnerie wrote:
> > On Sonntag, 18. Juni 2006 01:37 Michael Monnerie wrote:
> > > So my DSN had to contain "dbname=" and "host=", separated via
> > > semicolon.
> >
> > Nobody of the devs got anything to say on that? I'm not sure if I
> > did everything correct (at least it works now), at least the
> > documentation is not correct/misleading/strange.
>
> Semicolon is a usual separator between components of dsn in
> DBI::connect.
>
> See man page of a Perl module DBI, among others it says
Yes, but I was referring to the wiki:
http://wiki.apache.org/spamassassin/BetterDocumentation/SqlReadmeBayes?highlight=%28sql%29
http://wiki.apache.org/spamassassin/UsingSQL?highlight=%28sql%29
Both pages do not refer to that, it could be improved. I would do it,
but don't really have knowledge about this issue. So I was hoping
somebody would step up - there maybe others relying on that pages.
mfg zmi
--
// Michael Monnerie, Ing.BSc ----- http://it-management.at
// Tel: 0660/4156531 .network.your.ideas.
// PGP Key: "curl -s http://zmi.at/zmi3.asc | gpg --import"
// Fingerprint: 44A3 C1EC B71E C71A B4C2 9AA6 C818 847C 55CB A4EE
// Keyserver: www.keyserver.net Key-ID: 0x55CBA4EE
Re: SQL Bayes with Postgres in SUSE9.3
Posted by Mark Martinec <Ma...@ijs.si>.
On Thursday June 22 2006 01:25, Michael Monnerie wrote:
> On Sonntag, 18. Juni 2006 01:37 Michael Monnerie wrote:
> > So my DSN had to contain "dbname=" and "host=", separated via
> > semicolon.
>
> Nobody of the devs got anything to say on that? I'm not sure if I did
> everything correct (at least it works now), at least the documentation
> is not correct/misleading/strange.
Semicolon is a usual separator between components of dsn in DBI::connect.
See man page of a Perl module DBI, among others it says:
Examples of $data_source values are:
dbi:DriverName:database_name
dbi:DriverName:database_name@hostname:port
dbi:DriverName:database=database_name;host=hostname;port=port
It is recommended that drivers support the ODBC style, shown in the
last example above. It is also recommended that that they support
the three common names '"host"', '"port"', and '"database"' (plus
'"db"' as an alias for "database"). This simplifies automatic con-
struction of basic DSNs: "dbi:$driver:data-
base=$db;host=$host;port=$port". Drivers should aim to 'do some-
thing reasonable' when given a DSN in this form, but if any part is
meaningless for that driver (such as 'port' for Informix) it should
generate an error if that part is not empty.
Mark
Re: SQL Bayes with Postgres in SUSE9.3
Posted by Michael Monnerie <mi...@it-management.at>.
On Sonntag, 18. Juni 2006 01:37 Michael Monnerie wrote:
> So my DSN had to contain "dbname=" and "host=", separated via
> semicolon.
Nobody of the devs got anything to say on that? I'm not sure if I did
everything correct (at least it works now), at least the documentation
is not correct/misleading/strange.
mfg zmi
--
// Michael Monnerie, Ing.BSc ----- http://it-management.at
// Tel: 0660/4156531 .network.your.ideas.
// PGP Key: "curl -s http://zmi.at/zmi3.asc | gpg --import"
// Fingerprint: 44A3 C1EC B71E C71A B4C2 9AA6 C818 847C 55CB A4EE
// Keyserver: www.keyserver.net Key-ID: 0x55CBA4EE