When mod_archive_odbc tries to save messages to MySQL in log appears this message
=ERROR REPORT==== 2007-12-17 19:48:03 ===
** Generic server ejabberd_mod_archive_odbc_localhost terminating
** Last message in was {'$gen_cast',
{addlog,
to,
"admin",
"localhost",
"Psi",
{jid,
"sergey",
"localhost",
[],
"sergey",
"localhost",
[]},
[],
[],
"sdfsdf"}}
** When Server state == {state,"localhost",
{dict,0,
16,
16,
8,
80,
48,
{[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[]},
{{[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[]}}},
1800}
** Reason for termination ==
** {'module could not be loaded',
[{ejabberd_odbc,
sql_transaction,
["localhost",#Fun<mod_archive_odbc.11.118138705>]},
{mod_archive_odbc,run_sql_transaction,2},
{mod_archive_odbc,should_store_jid,2},
{mod_archive_odbc,handle_cast,2},
{gen_server,handle_msg,6},
{proc_lib,init_p,5}]}
And DB is empty:
mysql> show tables;
+----------------------+
| Tables_in_ejabberd |
+----------------------+
| archive_collections |
| archive_global_prefs |
| archive_jid_prefs |
| archive_messages |
+----------------------+
4 rows in set (0.00 sec)
mysql> select * from archive_messages;
Empty set (0.00 sec)
I thouht ODBC doesnt work correctly, but it isn't true:
1> {ok, Ref} = odbc:connect("DSN=ejabberd;UID=root;PWD=password", []).
{ok,<0.43.0>}
It's my configuration file:
% $Id: ejabberd.cfg.example 577 2006-06-07 08:38:37Z mremond $
%override_acls.
% Users that have admin access. Add line like one of the following after you
% will be successfully registered on server to get admin access:
{acl, admin, {user, "admin"}}.
% Blocked users:
%{acl, blocked, {user, "test"}}.
% Local users:
{acl, local, {user_regexp, ""}}.
% Everybody can create pubsub nodes
{access, pubsub_createnode, [{allow, all}]}.
% Only admins can use configuration interface:
{access, configure, [{allow, admin}]}.
% Every username can be registered via in-band registration:
% You could replace {allow, all} with {deny, all} to prevent user from using
% in-band registration
{access, register, [{allow, all}]}.
% After successful registration user will get message with following subject
% and body:
{welcome_message,
{"Welcome!",
"Welcome to Jabber Service. "
"For information about Jabber visit http://jabber.org"}}.
% Replace them with 'none' if you don't want to send such message:
%{welcome_message, none}.
% Only admins can send announcement messages:
{access, announce, [{allow, admin}]}.
% Only non-blocked users can use c2s connections:
{access, c2s, [{deny, blocked},
{allow, all}]}.
% Set shaper with name "normal" to limit traffic speed to 1000B/s
{shaper, normal, {maxrate, 1000}}.
% Set shaper with name "fast" to limit traffic speed to 50000B/s
{shaper, fast, {maxrate, 50000}}.
% For all users except admins used "normal" shaper
{access, c2s_shaper, [{none, admin},
{normal, all}]}.
% For all S2S connections used "fast" shaper
{access, s2s_shaper, [{fast, all}]}.
% Admins of this server are also admins of MUC service:
{access, muc_admin, [{allow, admin}]}.
% All users are allowed to use MUC service:
{access, muc, [{allow, all}]}.
% This rule allows access only for local users:
{access, local, [{allow, local}]}.
% Authentication method. If you want to use internal user base, then use
% this line:
{auth_method, internal}.
% For authentication via ODBC use the following:
%{auth_method, odbc}.
%{odbc_server, "DSN=ejabberd;UID=ejabberd;PWD=ejabberd"}.
{odbc_server, "DSN=ejabberd;UID=root;PWD=password"}.
% Host name:
{hosts, ["localhost"]}.
%% Define the maximum number of time a single user is allowed to connect:
{max_user_sessions, 10}.
%%--------------------------- my
{host_config, "localhost", [{acl, admin, {user, "admin", "localhost"}}]}.
% Default language for server messages
{language, "en"}.
% Listened ports:
{listen,
[{5222, ejabberd_c2s, [{access, c2s}, {shaper, c2s_shaper},
{max_stanza_size, 65536},
starttls, {certfile, "./ssl.pem"}]},
{5223, ejabberd_c2s, [{access, c2s},
{max_stanza_size, 65536},
tls, {certfile, "./ssl.pem"}]},
% Use these two lines instead if TLS support is not compiled
%{5222, ejabberd_c2s, [{access, c2s}, {shaper, c2s_shaper}]},
%{5223, ejabberd_c2s, [{access, c2s}, ssl, {certfile, "./ssl.pem"}]},
{5269, ejabberd_s2s_in, [{shaper, s2s_shaper},
{max_stanza_size, 131072}
]},
{5280, ejabberd_http, [http_poll, web_admin]},
{8888, ejabberd_service, [{access, all},
{hosts, ["icq.localhost", "sms.localhost"],
[{password, "secret"}]}]}
]}.
% Use STARTTLS+Dialback for S2S connections
{s2s_use_starttls, true}.
{s2s_certfile, "./ssl.pem"}.
% If SRV lookup fails, then port 5269 is used to communicate with remote server
{outgoing_s2s_port, 5269}.
% Used modules:
{modules,
[
{mod_register, [{access, register}]},
{mod_roster, []},
{mod_privacy, []},
{mod_adhoc, []},
{mod_configure, []}, % Depends on mod_adhoc
{mod_configure2, []},
{mod_disco, []},
{mod_stats, []},
{mod_vcard, []},
{mod_offline, []},
{mod_announce, [{access, announce}]}, % Depends on mod_adhoc
{mod_echo, [{host, "echo.localhost"}]},
{mod_private, []},
{mod_irc, []},
{mod_archive_odbc, [{database_type, "mysql"}, {default_auto_save, true}, {enforce_default_auto_save, true}]},
% Default options for mod_muc:
% host: "conference." ++ ?MYNAME
% access: all
% access_create: all
% access_admin: none (only room creator has owner privileges)
{mod_muc, [{access, muc},
{access_create, muc},
{access_admin, muc_admin}]},
% {mod_muc_log, []},
% {mod_shared_roster, []},
{mod_pubsub, [{access_createnode, pubsub_createnode}]},
{mod_time, []},
{mod_last, []},
{mod_version, []}
]}.
Thanks!
./configure --enable-odbc
Ok, you have the erlang module odbc, which is included in Erlang/OTP.
However, that error message seems to complain that you don't have installed the erlang module 'ejabberd_odbc', which is included in ejabberd. When you are compiling ejabberd, remember to enable odbc:
All internet tutorials about
All internet tutorials about mod_archive in Ejabberd are incomplete or very caotics. Or maybe are old. So my problem is that I am using Ubuntu 12.04 server LTS with Mysql. And I did all the things that are explained in all tutorials or blogs.
So to install mod_archive I need to do this, the typical:https://svn.process-one.net/ejabberd-modules
>> svn co
>> cd ejabberd-modules/mod_archive/trunk
>> ./build.sh
>> cp ebin/*modules in EJABBERD
>> and configure /etc/ejjaberd.cfg
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ but with this methods EJABBERD does not work!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
So I discover that we need to compile other MODULE that are not explained in any site. The module is called CONN_MYSQL
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡We need CONN_MYSQ!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
And we can get in the same ejabber-modules dowloaded. So in SVN (https://svn.process-one.net/ejabberd-modules ) there are cd ejabberd-modules/mysql/trunk ./build.sh cp ebin/*modules in EJABBERD
And work !!! Fine!!! :D :D
I need a lot of hours to discover this :'(
I can not use this line configuration in ejabberd.cfg: {odbc_server, "DSN=ejabberd;UID=ejabberd;PWD=ejabberd"} because aplication crashes and says this:
=ERROR REPORT==== 2012-11-28 18:01:08 === E(<0.437.0>:mod_archive_odbc:867) : should_store_jid failed: {xmlelement, "error", [{"code","500"}, {"type", "wait"}], [{xmlelement, "internal-server-error", [{"xmlns", "urn:ietf:params:xml:ns:xmpp-stanzas"}], []}]}
So I use this line in ejabberd.cfg: {odbc_server, {mysql, "server", "database", "username", "password"}}.
and this line into the modules configuration: {mod_archive_odbc, [{database_type, "mysql"}, {default_auto_save, true}, {enforce_default_auto_save, true}]},
So, now works!!!!!!!!!
I don't remmember if I use
'trunk' or 'branches/ejabberd-2.0.x' in Emakefile . You could try one and if not works you could try the other.
Ah! and remmember to compile with:
./configure --enable-odbc
the ejabberd source code. You can get this in "wget http://www.process-one.net/en/ejabberd/ejabberd/2.1.11/ejabberd-2.1.11.tgz"
maybe it is necessary this packages: "apt-get install iodbc libmyodbc"
Good luck!!