openfire 使用其他数据库的用户

摘抄 http://www.cnblogs.com/hannover/archive/2008/12/12/1353806.html

 

1、启动ajmessage服务器,然后进入

http://172.16.15.110:9090/server-properties.jsp (系统属性配置)

insert into ofproperty( name, propValue) values( 'jdbcAuthProvider.passwordSQL'    ,   'select pass from user where name=?'  );
 
insert into ofproperty( name, propValue) values( 'jdbcAuthProvider.passwordType'   ,   'plain'  );
//plain属性表示是对密码不做任何加密处理
//md5 
//sha1 
//sha256 
//sha512 
 
insert into ofproperty( name, propValue) values(  'jdbcProvider.connectionString'   ,   'jdbc:mysql://172.16.32.72:3306/hb?user=root&password=admin' );
insert into ofproperty( name, propValue) values(  'jdbcProvider.driver'             ,   'com.mysql.jdbc.Driver' );
 
//用户登录使用(根据用户名来)
insert into ofproperty( name, propValue) values(   'jdbcUserProvider.loadUserSQL'    ,   'SELECT id,name,pass from user where name=?');
//查看所有用户使用
insert into ofproperty( name, propValue) values(  'jdbcUserProvider.allUsersSQL'    ,   'select name from user' );
 
insert into ofproperty( name, propValue) values(  'provider.auth.className'    ,   'org.jivesoftware.openfire.auth.JDBCAuthProvider' );
 
insert into ofproperty( name, propValue) values(  'provider.user.className'    ,   'org.jivesoftware.openfire.user.JDBCUserProvider' );
 
//所有的用户数量,用来分页处理
insert into ofproperty( name, propValue) values(  'jdbcUserProvider.userCountSQL'    ,   'SELECT count(id) from user' );

 

2、目标表的结构

SET FOREIGN_KEY_CHECKS=0;
-- ----------------------------
-- Table structure for `user`
-- ----------------------------
DROP TABLE IF EXISTS `user`;
CREATE TABLE `user` (
  `id` int(8) NOT NULL,
  `name` varchar(20) NOT NULL,
  `pass` varchar(64) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
 
-- ----------------------------
-- Records of user
-- ----------------------------
INSERT INTO `user` VALUES ('1', 'admin', 'admin');
INSERT INTO `user` VALUES ('2', 'hb', 'hb');
INSERT INTO `user` VALUES ('3', 'zqt', 'zqt');


阅读更多
个人分类: openfire & XMPP
上一篇webservcie生成客户端代码报错----javax.xml.ws.soap.SOAPFaultException: Cannot create a sec
下一篇模拟“事件监听器”(二)
想对作者说点什么? 我来说一句

没有更多推荐了,返回首页

关闭
关闭