I am developing a Java application that requires accessing a Jabber server and download Jabber messages. Once messages are downloaded, I am planning to use Jabber technology to update a MySQL database running on the same server hosting the Jabber server (JabberD). Is it possible to use JDBC and Smack together? Is there any example program or some help file describing an approach to do this?
Yes, it’‘s possible to use Smack and JDBC “together”. I don’'t have any example at hand but you can use any example you have with JDBC and make it work with Smack objects.
I think I have to explain my problem further. I do not want to use JDBC code in my client. Rather, can I write a server-side extension that can be invoked from JabberD? The server-side extension may use JDBC and Smack objects. Is such a scheme possible?
If your requirement is to intercept all the messages sent to the server in order to save them to a DB then you will have to extend/modify the XMPP server that you are using. Since you are using jabberd I’‘d recommend posting this enquiry to their mailing list. Smack is an XMPP client so it won’'t be of much help in this case.
On the other hand, if you need to save the messages received by an XMPP client then Smack is the right choice. As I said before, you can easily use Smack and JDBC to save any information you may need to the DB.