mod_logdb: Could not connect to MySQL Server

Hi,

i have ejabberd 2.1.4 and try to run mog_logdb. But it can't connect to the MySQL Database (5.1.41).
I also tried it with MySQL 5.0.xx

erlang.log:

=CRASH REPORT==== 31-Jul-2010::20:12:30 ===
  crasher:
    pid: <0.407.0>
    registered_name: 'mod_logdb_mysql5_example.tld'
    exception exit: {undef,
                        [{mysql_conn,start,
                             ["localhost","3306","xxx","xxx",
                              "jabberlog",
                              [65536,131072],
                              #Fun<mod_logdb_mysql5.1.37672236>]},
                         {mod_logdb_mysql5,init,1},
                         {gen_server,init_it,6},
                         {proc_lib,init_p,5}]}
      in function  gen_server:init_it/6
    initial call: gen:init_it(gen_server,<0.406.0>,self,
                              {local,'mod_logdb_mysql5_example.tld'},
                              mod_logdb_mysql5,
                              ["example.tld",
                               [{user,"xxx"},
                                {password,"xxx"},
                                {server,"localhost"},
                                {port,"3306"},
                                {db,"jabberlog"}]],
                              [])
    ancestors: ['ejabberd_mod_logdb_example.tld',ejabberd_sup,<0.36.0>]
    messages: []
    links: []
    dictionary: []
    trap_exit: false
    status: running
    heap_size: 610
    stack_size: 23
    reductions: 215
  neighbours:

ejabberd.log:

=ERROR REPORT==== 2010-07-31 20:22:00 ===
E(<0.455.0>:mod_logdb:354) : Failed to start: {undef,
                                               [{mysql_conn,start,
                                                 ["localhost","3306",
                                                  "xxx","xxx",
                                                  "jabberlog",
                                                  [65536,131072],
                                                  #Fun<mod_logdb_mysql5.1.37672236>]},
                                                {mod_logdb_mysql5,init,1},
                                                {gen_server,init_it,6},
                                                {proc_lib,init_p,5}]}

=ERROR REPORT==== 2010-07-31 20:22:00 ===
** Generic server 'ejabberd_mod_logdb_example.tld' terminating
** Last message in was start
** When Server state == {state,"example.tld",mod_logdb_mysql5,undefined,
                            undefined,undefined,undefined,
                            [{user,"xxx"},
                             {password,"xxx"},
                             {server,"localhost"},
                             {port,"3306"},
                             {db,"jabberlog"}],
                            [{mysql5,
                                 [{user,"xxx"},
                                  {password,"xxx"},
                                  {server,"localhost"},
                                  {port,"3306"},
                                  {db,"jabberlog"}]}],
                            true,[],all,14,10,true}
** Reason for termination ==
** db_connection_failed

I tried the patched MySQL Driver, the newest from SVN and http://code.google.com/p/erlang-mysql-driver/

Can anyone help me?

Seberoth wrote: Hi, i have

Seberoth wrote:

Hi,

i have ejabberd 2.1.4 and try to run mog_logdb. But it can't connect to the MySQL Database (5.1.41).
I also tried it with MySQL 5.0.xx

erlang.log:

    exception exit: {undef,
                        [{mysql_conn,start,
                             ["localhost","3306","xxx","xxx",
                              "jabberlog",
                              [65536,131072],
                              #Fun<mod_logdb_mysql5.1.37672236>]},
                         {mod_logdb_mysql5,init,1},
                         {gen_server,init_it,6},
                         {proc_lib,init_p,5}]}

I tried the patched MySQL Driver, the newest from SVN and http://code.google.com/p/erlang-mysql-driver/

Can anyone help me?

The error means that erlang couldn't find a file called mysql_conn.beam, or that the file was found but it doesn't export a function called start/7, where 7 is the 7 arguments that mod_logdb_mysql5 provided in that function call.

Now you can check all the different mysql_conn.erl versions that you have downloaded, and find one that contains something like this:

-export([start/7,
   ...

Once you find the proper mysql driver, compile it and install it (or copy it with all the other ejabberd *.beam files).

Ok. Now I use a

Ok. Now I use a mysql_conn.beam wirh start/7. But now i get the next error^^

=CRASH REPORT==== 5-Aug-2010::20:26:03 ===
  crasher:
    pid: <0.1244.0>
    registered_name: 'mod_logdb_mysql5_web-sim.de'
    exception exit: {function_clause,
                        [{mysql_conn,start,
                             ["localhost","3306","ejabberd","test",
                              "jabberlog",
                              [65536,131072],
                              #Fun<mod_logdb_mysql5.1.37672236>]},
                         {mod_logdb_mysql5,init,1},
                         {gen_server,init_it,6},
                         {proc_lib,init_p,5}]}
      in function  gen_server:init_it/6
    initial call: gen:init_it(gen_server,<0.1243.0>,self,
                              {local,'mod_logdb_mysql5_web-sim.de'},
                              mod_logdb_mysql5,
                              ["web-sim.de",
                               [{user,"ejabberd"},
                                {password,"test"},
                                {server,"localhost"},
                                {port,"3306"},
                                {db,"jabberlog"}]],
                              [])
    ancestors: ['ejabberd_mod_logdb_web-sim.de',ejabberd_sup,<0.850.0>]
    messages: []
    links: []
    dictionary: []
    trap_exit: false
    status: running
    heap_size: 610
    stack_size: 23
    reductions: 163
  neighbours:

The only differnce is the "exception exit: {function_clause".

Check your config

Seberoth wrote:

Ok. Now I use a mysql_conn.beam wirh start/7. But now i get the next error^^

    exception exit: {function_clause,
                        [{mysql_conn,start,
                             ["localhost","3306","ejabberd","test",
                              "jabberlog",
                              [65536,131072],
                              #Fun<mod_logdb_mysql5.1.37672236>]},
                         {mod_logdb_mysql5,init,1},

The only differnce is the "exception exit: {function_clause".

The function start wants the port to be an integer, like 3306, but you provided a string like "3306" (or maybe it's a bug in mod_logdb?).

Check your configuration file and replace "3306" with 3306.

Now its working. Thanks

Now its working. Thanks

Seberoth, Can you please

Seberoth,
Can you please elaborate - what is the version of ejabberd you got it to work on and where you found the mysql_conn.erl source file with "start/7"? I only find source files with "start/6".
I actually found one that has "start/7" but it breaks big time, here're some excerpts from the ejabberd log file:
==============================
=INFO REPORT==== 2012-04-11 14:53:40 ===
I(<0.264.0>:mod_logdb_mysql5:142) : Opening mysql connection root@server.localdomain:3306/db123

=ERROR REPORT==== 2012-04-11 14:53:40 ===
Error in process <0.266.0> on node 'ejabberd@localhost' with exit value: {function_clause,[{mysql_conn,do_recv,[[65536,131072],<0.268.0>,undefined]},{mysql_conn,mysql_init,5},{mysql_conn,init,8}]}

...

=ERROR REPORT==== 2012-04-11 14:53:45 ===
E(<0.264.0>:mod_logdb_mysql5:127) : MySQL connection failed: "timed out"

==============================

Looking at mysql query logs, it doesn't issue any commands to my mysql server, not even authentication; netstat shows "TIME_WAIT" but never actually goes into "ESTABLISHED" for (ejabberd) <---> (mysql server) connection
I don't know any erlang so I'm at loss here. Any help/clues would be greatly appreciated.

Syndicate content