Dashboard > ejabberd > ... > Using relational databases > Using ejabberd with Microsoft SQL Server
Using ejabberd with Microsoft SQL Server Log In View a printable version of the current page.

Added by Mickaël Rémond , last edited by Mickaël Rémond on Jun 06, 2006  (view change)
Labels: 

ejabberd can be installed to run with Microsoft SQL Server. ejabberd is supported with MS SQL Server 2000. You need an ejabberd with the MSSQL patch.

  1. Install Microsoft SQL Server 2000.
  2. Open "SQL Server Enterprise Manager" to create and setup the database. Create a new database called 'ejabberd'.
  3. Use the "Query Analyzer" tool to run the database creation script.
  4. Create an ODBC datasource (from "Config Panel" -> "Data source (ODBC)"). The new ODBC datasource can be named ejabberd.
  5. Modify the config file to use your newly created MSSQL database:
    % Comment Internal Authentication:
    %{auth_method, internal}.
    % Define ODBC authentication:
    {auth_method, odbc}.
    {odbc_server, "DSN=ejabberd;UID=sa;PWD=nimda"}.
    1. Start ejabberd (from the "Start" menu, and from the console try creating a new user:
      (ejabberd@home-68006dc09b)2> ejabberd_auth:try_register("admin", "localhost", "nimda").
      {atomic,ok}
  6. Try connecting from a Jabber client, with your newly connected user.
  7. Check that the newly created user has been correctly added to your database using the MSSQL "Query Analyzer":
    select * from [dbo].[users];
  8. Modify the config file to enable the odbc module you need, by remplacing the module name by their '_odbc' counterparts:
    {mod_roster_odbc, []},
    {mod_offline_odbc,[]},
    {mod_last_odbc,   []},

    #Restart ejabberd

Note: The mod_vcard_odbc does not work for now with MSSQL and is not supported with MSSQL.

Anonymous

I have done as the above has said, but without success.

Can anybody please be kind enough to explain those procedure in details?
Such as how to configure that ODBC?

Thank you very much.

Reply To This
Anonymous

I'm working on a Windows XP platform for testing purposes, but will move it to a Windows 2003 platform if I ever get this working.

 I finally got ejabberd working with the internal database, but when I try to attach it to sql server, it take a long time to start and then when I try to register any users, it tells me they are already registered, when, in fact, they are not.

I broke apart the sasl log and found this:

=PROGRESS REPORT==== 31-May-2007::17:01:43 ===
         application: odbc
          started_at: ejabberd@localhost

=CRASH REPORT==== 31-May-2007::17:01:43 ===
  crasher:
    pid: <0.228.0>
    registered_name: []
    error_info: {undef,[{repos,binpath,[odbc]},
                         {odbc,init,1},
                         {gen_server,init_it,6},
                         {proc_lib,init_p,5}]}
    initial_call: {gen,init_it,
                      [gen_server,
                       <0.227.0>,
                       <0.227.0>,
                       odbc,
                       [{client,<0.222.0>}],
                       []]}
    ancestors: [odbc_sup,<0.226.0>]
    messages: []
    links: [#Port<0.264>,<0.227.0>,#Port<0.263>]
    dictionary: []
    trap_exit: true
    status: running
    heap_size: 233
    stack_size: 21
    reductions: 416
  neighbours:

=CRASH REPORT==== 31-May-2007::17:02:13 ===
  crasher:
    pid: <0.222.0>
    registered_name: []
    error_info: odbc_connection_failed
    initial_call: {gen,init_it,
                      [gen_server,
                       <0.221.0>,
                       <0.221.0>,
                       ejabberd_odbc,
                       ["aggielaptop"],
                       []]}
    ancestors: [ejabberd_odbc_sup_aggielaptop,ejabberd_sup,<0.35.0>]
    messages: []
    links: [<0.221.0>]
    dictionary: []
    trap_exit: false
    status: running
    heap_size: 233
    stack_size: 21
    reductions: 190
  neighbours:

=SUPERVISOR REPORT==== 31-May-2007::17:02:13 ===
     Supervisor: {local,
                                              ejabberd_odbc_sup_aggielaptop}
     Context:    start_error
     Reason:     odbc_connection_failed
     Offender:   [{pid,undefined},
                  {name,1},
                  {mfa,{ejabberd_odbc,start_link,["aggielaptop"]}},
                  {restart_type,transient},
                  {shutdown,brutal_kill},
                  {child_type,worker}]

Anyone have any ideas?

Thanks!!!!

Reply To This

Hello,

Which version are you using ? The ejabberd installer 1.1.3 ?
This is the one you should use, as it seems you are missing the ODBC module.

Reply To This
Anonymous

Yes, the installation file is the 1.1.3 version.  The name of the install file is: ejabberd-1.1.3_1-windows-installer.exe.

 I'll go back through setup and see if the odbc package was optional or something . . .

Reply To This
Anonymous

Hello,

I'm working on windows server 2003,The ejabberd installer 1.1.4 .

when i run the debug console, try the error message "Shell process terminated! (^G to start new job)" 

and do not login use the admin user.

please.

Reply To This

The install might have failed.
Could you send us the bitrock*.log file (in temp directory) (contact at process-one.net) ?
Thank you.

Reply To This
Anonymous

Hi,

 When I tried to configure the database as above, I am getting the following error. Can anyone help me out of this.

Erlang (BEAM) emulator version 5.5.5 [async-threads:0]

Eshell V5.5.5  (abort with ^G)
1> ejabberd@locahost.
ejabberd@locahost
2> try_register("admin", "localhost", "testuser").

=ERROR REPORT==== 17-Apr-2008::17:34:39 ===
Error in process <0.30.0> with exit value: {undef,[

Unknown macro: {shell_default,try_register,["admin","localhost","testuser"]}
,
Unknown macro: {erl_eval,do_apply,5}

,

Unknown macro: {shell,exprs,6}
,
Unknown macro: {shell,eval_loop,3}
]}

** exited: {undef,[

Unknown macro: {shell_default,try_register,                                  ["admin","localhost","testuser"]}
,
                  

,
                  
Unknown macro: {shell,exprs,6}
,
                  
Unknown macro: {shell,eval_loop,3}
]} **
3>

Reply To This
Add Comment
Powered by Atlassian Confluence 2.7.3, the Enterprise Wiki. Bug/feature request - Atlassian news - Contact administrators