search
HomeDatabaseMysql TutorialLinux下安装ejabberd支持MSSQL

一、Linux下安装unixODBC、freetds源码包:freetds-0.82.tar.gz、unixODBC-2.3.0.tar.gz1. 安装unixODBCgunzip unixODBC-2.3.t

一、Linux下安装unixODBC、freetds

源码包:freetds-0.82.tar.gz、unixODBC-2.3.0.tar.gz

1.  安装unixODBC

gunzip  unixODBC-2.3.tar.gz

tar zxvf unixODBC-2.3.tar

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

make

make install

2.  安装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,向ODBC添加SQLServer驱动

# vi etc/odbcinst.ini

写入如下内容:

[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

添加DSN

# vi etc/odbc.ini

写入如下内容

[ejabberd]

Driver          = SQLSERVER

Description     = SQLSERVER

Server          = 192.168.2.159

Database        = ejabberd

Port            = 1433

odbcinst.ini中的驱动名称,Database是数据库的名称

保存并退出。

测试ODBC的连接

# bin/isql -v ejabberd sa 111111

SQL>

SQL> quit

二、   ejabberd修改odbc文件

1.  安装ejabberd二进制包(略)

安装位置为/usr/local/ejabberd

2.  修改ejabberd的ODBC文件

进入/usr/local/ejabberd/conf目录

Vi odbc.ini

再次添加DSN信息:

[ejabberd]

Driver          = SQLSERVER

Description     = SQLSERVER

Server          = 192.168.2.159

Database        = ejabberd

Port            = 1433

Vi odbcinst.ini

再次添加MSSQL的driver信息:

[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

注:用二进制安装的包,,Ejabberd包内置安装了一部分ODBC文件,但是包没有安装完全。

[root@ejabberd bin]# pwd

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

[root@ejabberd bin]# ls

odbcserver

Ejabberd会调用此文件odbcserver,运行此文件会提示找不到libodbc.so.1

此时我们自己安装的unixODBC位于/usr/local/unixODBC下。

我们做一个软链接即可调用:

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

三、   ejabberd修改配置文件

修改配置文件路径:/usr/local/ejabberd/conf/ejabberd.cfg

1.       验证修改

这个选项值的名字可能被误导, 因为 auth_method 名字用于通过ODBC以及通过原生MySQL接口访问关系数据库.

把{auth_method, internal}.注释掉。

{auth_method, [odbc]}.

2.  数据库连接

实际的数据库访问使用选项 odbc_server 来定义. 它的值通常用来定义我们是否想使用 ODBC, 或两个可用的原生接口之一。

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

3.  存储模块修改

以下几项,在原有基础上加上_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: 最后连接日期和时间

mod_offline_odbc: 离线消息

mod_privacy_odbc: 用户黑名单规则

mod_private_odbc: 私有XML存储

mod_pubsub_odbc:发行-订阅

mod_roster_odbc:名册管理

mod_vcard_odbc:用户的VCARD

四、   MSSQL扩展架构

利用ejabberd-2.1.4.tar.gz源码包ODBC自带的mssql2005.sql文件,执行生成表和主键。

五、   其他配置

删除以前的数据库文件,进入/usr/local/ejabberd/database 目录,

删除ejabberd@localhost

新建一个管理员用户,首先./start启动ejabberd

ejabberdctl register admin ejabberd 111111  添加一个用户

将用户加入到管理员进行web管理

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

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

注册用户正常可用。

linux

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
What Are the Limitations of Using Views in MySQL?What Are the Limitations of Using Views in MySQL?May 14, 2025 am 12:10 AM

MySQLviewshavelimitations:1)Theydon'tsupportallSQLoperations,restrictingdatamanipulationthroughviewswithjoinsorsubqueries.2)Theycanimpactperformance,especiallywithcomplexqueriesorlargedatasets.3)Viewsdon'tstoredata,potentiallyleadingtooutdatedinforma

Securing Your MySQL Database: Adding Users and Granting PrivilegesSecuring Your MySQL Database: Adding Users and Granting PrivilegesMay 14, 2025 am 12:09 AM

ProperusermanagementinMySQLiscrucialforenhancingsecurityandensuringefficientdatabaseoperation.1)UseCREATEUSERtoaddusers,specifyingconnectionsourcewith@'localhost'or@'%'.2)GrantspecificprivilegeswithGRANT,usingleastprivilegeprincipletominimizerisks.3)

What Factors Influence the Number of Triggers I Can Use in MySQL?What Factors Influence the Number of Triggers I Can Use in MySQL?May 14, 2025 am 12:08 AM

MySQLdoesn'timposeahardlimitontriggers,butpracticalfactorsdeterminetheireffectiveuse:1)Serverconfigurationimpactstriggermanagement;2)Complextriggersincreasesystemload;3)Largertablesslowtriggerperformance;4)Highconcurrencycancausetriggercontention;5)M

MySQL: Is it safe to store BLOB?MySQL: Is it safe to store BLOB?May 14, 2025 am 12:07 AM

Yes,it'ssafetostoreBLOBdatainMySQL,butconsiderthesefactors:1)StorageSpace:BLOBscanconsumesignificantspace,potentiallyincreasingcostsandslowingperformance.2)Performance:LargerrowsizesduetoBLOBsmayslowdownqueries.3)BackupandRecovery:Theseprocessescanbe

MySQL: Adding a user through a PHP web interfaceMySQL: Adding a user through a PHP web interfaceMay 14, 2025 am 12:04 AM

Adding MySQL users through the PHP web interface can use MySQLi extensions. The steps are as follows: 1. Connect to the MySQL database and use the MySQLi extension. 2. Create a user, use the CREATEUSER statement, and use the PASSWORD() function to encrypt the password. 3. Prevent SQL injection and use the mysqli_real_escape_string() function to process user input. 4. Assign permissions to new users and use the GRANT statement.

MySQL: BLOB and other no-sql storage, what are the differences?MySQL: BLOB and other no-sql storage, what are the differences?May 13, 2025 am 12:14 AM

MySQL'sBLOBissuitableforstoringbinarydatawithinarelationaldatabase,whileNoSQLoptionslikeMongoDB,Redis,andCassandraofferflexible,scalablesolutionsforunstructureddata.BLOBissimplerbutcanslowdownperformancewithlargedata;NoSQLprovidesbetterscalabilityand

MySQL Add User: Syntax, Options, and Security Best PracticesMySQL Add User: Syntax, Options, and Security Best PracticesMay 13, 2025 am 12:12 AM

ToaddauserinMySQL,use:CREATEUSER'username'@'host'IDENTIFIEDBY'password';Here'showtodoitsecurely:1)Choosethehostcarefullytocontrolaccess.2)SetresourcelimitswithoptionslikeMAX_QUERIES_PER_HOUR.3)Usestrong,uniquepasswords.4)EnforceSSL/TLSconnectionswith

MySQL: How to avoid String Data Types common mistakes?MySQL: How to avoid String Data Types common mistakes?May 13, 2025 am 12:09 AM

ToavoidcommonmistakeswithstringdatatypesinMySQL,understandstringtypenuances,choosetherighttype,andmanageencodingandcollationsettingseffectively.1)UseCHARforfixed-lengthstrings,VARCHARforvariable-length,andTEXT/BLOBforlargerdata.2)Setcorrectcharacters

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

SublimeText3 Linux new version

SublimeText3 Linux new version

SublimeText3 Linux latest version

MantisBT

MantisBT

Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

SAP NetWeaver Server Adapter for Eclipse

SAP NetWeaver Server Adapter for Eclipse

Integrate Eclipse with SAP NetWeaver application server.

VSCode Windows 64-bit Download

VSCode Windows 64-bit Download

A free and powerful IDE editor launched by Microsoft