经过数次实验,openfire终于可以调用已有的数据库用户表了。
1 安装openFire。
在安装过程中我使用的是sqlServer数据库,首先在数据库中建了一个库openfire。一开始始终链接不上,后来搜索说是用sqljdbc4.jar来驱动,于是下载下来,果然可以。
但是后来我有又使用了默认的jdbc驱动程序类,发现也是可以的,可能是当时把用户名、密码写错了。
等到链接上以后执行到最后登录控制台,查看openfire数据库就可以看到有好的数据表,其实我们要关心主要是这几个表ofProperty、ofUser。
然后参照篇文章做了http://www.cnblogs.com/2018/archive/2011/12/13/2279869.html相应处理。建立另外一个库(这个库就是我们要链接的自己用户表)
然后在openfire数据库中执行
insert into ofproperty(name,propValue)values
('jdbcProvider.driver','net.sourceforge.jtds.jdbc.Driver'),
('jdbcProvider.connectionString','jdbc:jtds:sqlserver://192.168.1.21/openfire;appName=openfire;user=of;password=00'),68); font-family:Arial; font-size:14px; line-height:26px">('admin.authorizedJIDs','[email protected]'),68); font-family:Arial; font-size:14px; line-height:26px">('jdbcAuthProvider.passwordsql','SELECT plainPassword FROM myUser WHERE username=?'),68); font-family:Arial; font-size:14px; line-height:26px">('jdbcAuthProvider.passwordType','plain'),68); font-family:Arial; font-size:14px; line-height:26px">('jdbcUserProvider.loadUsersql',242)">SELECT name,email FROM myUser WHERE username=?'),68); font-family:Arial; font-size:14px; line-height:26px">('jdbcUserProvider.userCountsql',242)">SELECT COUNT(*) FROM myUser'),68); font-family:Arial; font-size:14px; line-height:26px">('jdbcUserProvider.allUseRSSQL',242)">SELECT username FROM myUser'),68); font-family:Arial; font-size:14px; line-height:26px">('jdbcUserProvider.usernameField','username'),68); font-family:Arial; font-size:14px; line-height:26px">('jdbcUserProvider.nameField','name'),68); font-family:Arial; font-size:14px; line-height:26px">('jdbcUserProvider.emailField','email');
UPDATE ofProperty SET propValue='org.jivesoftware.openfire.user.JDBCUserProvider' WHERE
name='provider.user.className';
UPDATE ofProperty SET propValue='org.jivesoftware.openfire.auth.JDBCAuthProvider' WHERE
name='provider.auth.className';
这里主意('admin.authorizedJIDs',@后的值就是xmpp.domain对应的值
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。