Installing ejabberd in Linux supports MSSQL

Source: Internet
Author: User
Tags odbc connection
1. Install unixODBC and freetds source package in Linux: freetds-0.82.tar.gz?unixodbc-2.3.0.tar.gz 1. Install unixODBCgunzipunixODBC-2.3.t

1. Install unixODBC and freetds source package in Linux: freetds-0.82.tar.gz?unixodbc-2.3.0.tar.gz 1. Install unixODBCgunzip unixODBC-2.3.t.

1. Install unixODBC and freetds in Linux

Source code package: freetds-0.82.tar.gz?unixodbc-2.3.0.tar.gz

1. Install unixODBC

Gunzip unixODBC-2.3.tar.gz

Tar zxvf unixODBC-2.3.tar

./Configure -- prefix =/usr/local/unixODBC

Make

Make install

2. Install freetds

Tar zxvf freetds-0.82.tar.gz

Cd freetds-0.82

./Configure -- prefix =/usr/local/freetds -- with-unixodbc =/usr/local/unixODBC -- with-tdsver = 8.0

Make

Make install

Cd/usr/local/unixODBC, add SQLServer driver to ODBC

# Vi etc/odbcinst. ini

Write the following content:

[ODBC]

Trace = Yes

TraceFile =/tmp/SQL. log

ForceTrace = Yes

Pooling = No

[SQLSERVER]

Description = SQLSERVER

Driver =/usr/local/freetds/lib/libtdsodbc. so

Setup =/usr/local/freetds/lib/libtds. so

UsageCount = 1

CPTimeout = 5

CPReuse = 5

FileUsage = 1

Add DSN

# Vi etc/odbc. ini

Write the following content

[Ejabberd]

Driver = SQLSERVER

Description = SQLSERVER

Server = 192.168.2.159

Database = ejabberd

Port = 1433

Driver name in odbcinst. ini. Database is the name of the Database

Save and exit.

Test ODBC connection

# Bin/isql-v ejabberd sa 111111

SQL>

SQL> quit

Ii. Modify odbc files using ejabberd

1. Install the ejabberd Binary Package (omitted)

Installation path:/usr/local/ejabberd

2. Modify the ODBC file of ejabberd

Go to the/usr/local/ejabberd/conf directory.

Vi odbc. ini

Add the DSN information again:

[Ejabberd]

Driver = SQLSERVER

Description = SQLSERVER

Server = 192.168.2.159

Database = ejabberd

Port = 1433

Vi odbcinst. ini

Add the driver information of MSSQL again:

[ODBC]

Trace = Yes

TraceFile =/tmp/SQL. log

ForceTrace = Yes

Pooling = No

[SQLSERVER]

Description = SQLSERVER

Driver =/usr/local/freetds/lib/libtdsodbc. so

Setup =/usr/local/freetds/lib/libtds. so

UsageCount = 1

CPTimeout = 5

CPReuse = 5

FileUsage = 1

Note: Some ODBC files are installed in the Ejabberd package, but the package is not completely installed.

[Root @ ejabberd bin] # pwd

/Usr/local/ejabberd/lib/odbc-2.10.3/priv/linux-x86/bin

[Root @ ejabberd bin] # ls

Odbcserver

Ejabberd will call this file odbcserver. Running this file will prompt that libodbc. so.1 cannot be found

In this case, the unixODBC we installed is located in/usr/local/unixODBC.

We can make a soft link to call:

Ln-s/usr/local/unixODBC/lib/libodbc. so.1/usr/lib

Iii. modify the configuration file of ejabberd

Modify the configuration file path:/usr/local/ejabberd/conf/ejabberd. cfg

1. Verify the modification

The name of this option value may be misleading because the auth_method name is used to access the relational database through ODBC and through the native MySQL interface.

Comment out {auth_method, internal.

{Auth_method, [odbc]}.

2. Database Connection

The actual database access is defined using the option odbc_server. Its value is usually used to determine whether we want to use ODBC or one of two available native interfaces.

{Odbc_server, "DSN = ejabberd; UID = sa; PWD = 111111 "}.

3. Modify the storage module

Add _ odbc

Mod_last_odbc, mod_offline_odbc, mod_privacy_odbc, mod_private_odbc, mod_pubsub_odbc, mod_roster_odbc, mod_vcard_odbc

Mod_last_odbc: Last connection Date and Time

Mod_offline_odbc: offline message

Mod_privacy_odbc: User blacklist rule

Mod_private_odbc: Private XML storage

Mod_pubsub_odbc: publish-subscribe

Mod_roster_odbc: register management

Mod_vcard_odbc: Your VCARD

Iv. MSSQL extended Architecture

Use the mssql2005. SQL file that comes with ODBC in the source code package ejabberd-2.1.4.tar.gz to generate tables and primary keys.

5. Other configurations

Delete the previous database file and go to the/usr/local/ejabberd/database directory,

Delete ejabberd @ localhost

Create an administrator user. First, start ejabberd.

Ejabberdctl register admin ejabberd 111111 Add a user

Add users to the Administrator for web Management

{Acl, admin, {user, "admin", "ejabberd "}}.

{Access, configure, [{allow, admin}]}.

The registered user is available normally.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.