2013-07-18 49 views
4

嗨,我無法將現有的OpenFire安裝與現有的數據庫集成。OpenFire集成外部數據庫

我有2個數據庫,即(例如目的)

  1. db_mainsite
  2. db_openfire

裏面我db_mainsite我有一個名爲User表,其中有位於兩列分別gw_userunique和gw_password( VARCHAR 255,但是使用SHA-1散列算法)。

這兩個數據庫位於相同的機器(服務器)內,因此具有相同的物理位置。

在我的conf/openfire.xml我已經設置了以下行

<jive> 
    ... 
    <jdbcProvider> 
    <driver>com.mysql.jdbc.Driver</driver> 
    <connectionString>jdbc:mysql://localhost/db_mainsite?user=username&amp;password=secret</connectionString> 
    </jdbcProvider> 
    <provider> 
    <auth> 
     <className>org.jivesoftware.openfire.auth.JDBCAuthProvider</className> 
    </auth> 
    </provider> 
    <jdbcAuthProvider> 
    <passwordSQL>SELECT password FROM tbl_user WHERE gw_userunique=?</passwordSQL> 
    <passwordType>sha1</passwordType> 
    </jdbcAuthProvider> 
    ... 
</jive> 

可悲的是,每當我試圖使用存儲在db_mainsite它總是失敗的用戶名+密碼登錄。

我也重新啓動OpenFire。

誰能告訴我什麼是錯的?

乾杯,

回答

0

沒有必要修改配置文件,只需要運行腳本在您的Openfire數據庫(在3.10.3驗證):

## add jdbc drive 
INSERT INTO `ofproperty` VALUES ('jdbcProvider.driver', 'com.mysql.jdbc.Driver'); 
## external membership database connection 
INSERT INTO `ofproperty` VALUES ('jdbcProvider.connectionString', 'jdbc:mysql://youripaddress:3306/db_mainsite?user=root&password=root'); 
## auth 
UPDATE `ofproperty` SET propValue='org.jivesoftware.openfire.auth.JDBCAuthProvider' WHERE  NAME='provider.auth.className'; 
## search password 
INSERT INTO `ofproperty` VALUES ('jdbcAuthProvider.passwordSQL', 'SELECT plainPassword FROM dzmembership WHERE id= ?'); 
## encrypted type:plain,md5,sha1,sha256,sha512 
INSERT INTO `ofproperty` VALUES ('jdbcAuthProvider.passwordType', 'plain'); 
## displyed in admin console 
UPDATE `ofproperty` SET propValue='org.jivesoftware.openfire.user.JDBCUserProvider' WHERE NAME='provider.user.className'; 
## uyser info in admin console 
INSERT INTO `ofproperty` VALUES ('jdbcUserProvider.loadUserSQL', 'SELECT username AS NAME,concat(username,''_'',nickname) FROM dzmembership WHERE id=?'); 
## user amount 
INSERT INTO `ofproperty` VALUES ('jdbcUserProvider.userCountSQL', 'SELECT COUNT(*) FROM dzmembership'); 
## all users 
INSERT INTO `ofproperty` VALUES ('jdbcUserProvider.allUsersSQL', 'SELECT id FROM dzmembership'); 
## search 
INSERT INTO `ofproperty` VALUES ('jdbcUserProvider.searchSQL', 'SELECT id FROM dzmembership WHERE'); 
## username displayed in console 
INSERT INTO `ofproperty` VALUES ('jdbcUserProvider.usernameField', 'username'); 
## id displayed in console 
INSERT INTO `ofproperty` VALUES ('jdbcUserProvider.nameField', 'id'); 
## email displayed in console 
INSERT INTO `ofproperty` VALUES ('jdbcUserProvider.emailField', 'email'); 
##admin username 
INSERT INTO `ofproperty` VALUES ('admin.authorizedJIDs', '[email protected]'); 
UPDATE ofproperty SET propValue='ipaddress' WHERE NAME='xmpp.domain'