Sql-server – Integrate Openfire with MS SqlServer

openfiresql serversql-server-2008xmpp

I originally posted this on stackoverflow. Not sure if this belongs on Serverfault. I am reasonably familiar with the guidelines of serverfault vs stackoverflow however, while it is a server question the goal is to get my XMPP development environment configured. Any recommendations on stackoverflow vs serverfault will also be appreciated.

Anyway here's my question

I am trying to configure my Openfire Server with an instance of MS SQL Server 2008.

I must admit that while I have used Sql Server extensively I have been successfully in using it in spite of myself as I am certainly not an expert (bottom line, you should not assume that I already made any obvious configurations). I also apologize in advance if there is anything so obviously wrong that this is a waste of time question.

My Basic SQL Information/Configuration

  • Server name: PALBU\PALBUSQL
  • Authentication: Sql Server Authentication
  • Login: sa
  • Password: mypassword

Here is my Openfire Settings/Screen shots

Server Settings

  • Domain: palbu

  • Admin Console Port: 9090

  • Secure Admin Console Port: 9091

I selected 'Standard Database Connection' under 'Database Settings'

Database Settings – Standard Connection

  • Database Driver Presets: Microsoft SQLServer
  • JDBC Driver Class: net.sourceforge.jtds.jdbc.Driver
  • Database URL: jdbc:jtds:sqlserver://PALBU/PALBUSQL;appName=jive
  • Username: su
  • Password: mypassword
  • Minimum Connections: 5
  • Maximum Connections: 25
  • Connection Timeout: 1.0 Days

When I try to connect I get an error message 'A connection to the database could not be made You may view the error message error.log'

Here is the Output from the error.log file

2011.07.12 11:10:43 Prototype
java.sql.SQLException: Network error IOException: Connection refused: connect
at net.sourceforge.jtds.jdbc.ConnectionJDBC2.(ConnectionJDBC2.java:385)
at net.sourceforge.jtds.jdbc.ConnectionJDBC3.(ConnectionJDBC3.java:50)
at net.sourceforge.jtds.jdbc.Driver.connect(Driver.java:182)
at java.sql.DriverManager.getConnection(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at org.logicalcobwebs.proxool.DefaultConnectionBuilder.buildConnection(DefaultConnectionBuilder.java:39)
at org.logicalcobwebs.proxool.Prototyper.buildConnection(Prototyper.java:159)
at org.logicalcobwebs.proxool.Prototyper.sweep(Prototyper.java:102)
at org.logicalcobwebs.proxool.PrototyperThread.run(PrototyperThread.java:44)
Caused by: java.net.ConnectException: Connection refused: connect
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(Unknown Source)
at java.net.PlainSocketImpl.connectToAddress(Unknown Source)
at java.net.PlainSocketImpl.connect(Unknown Source)
at java.net.SocksSocketImpl.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at sun.reflect.GeneratedMethodAccessor3.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at net.sourceforge.jtds.jdbc.SharedSocket.createSocketForJDBC3(SharedSocket.java:304)
at net.sourceforge.jtds.jdbc.SharedSocket.(SharedSocket.java:255)
at net.sourceforge.jtds.jdbc.ConnectionJDBC2.(ConnectionJDBC2.java:310)
… 8 more

I tried changing my DatabaseURL to just show my server URL

  • Database URL: PALBU/PALBUSQL

I received the same error in the Database Settings but received a different output in my log file.

  2011.07.12 11:16:12 Prototype
java.sql.SQLException: No suitable driver found for PALBURTUS/PALBURTUSSQL
    at java.sql.DriverManager.getConnection(Unknown Source)
    at java.sql.DriverManager.getConnection(Unknown Source)
    at org.logicalcobwebs.proxool.DefaultConnectionBuilder.buildConnection(DefaultConnectionBuilder.java:39)
    at org.logicalcobwebs.proxool.Prototyper.buildConnection(Prototyper.java:159)
    at org.logicalcobwebs.proxool.Prototyper.sweep(Prototyper.java:102)
    at org.logicalcobwebs.proxool.PrototyperThread.run(PrototyperThread.java:44)

It seems as though this driver is missing from the default Openfire installation, however I'm not very familiar with sql drivers so any help would be appreciated.

Best Answer

Is your SQL server configured to accept network connections? Or, is it on a non-standard port (1433 is default)? Or, is there a host-based firewall enabled on the server?

From that error message, it appears that the OpenFire server could resolve the name, but the attempt at connection was actively refused.

OpenFire takes a jdbc connection string, so it's to be expected that your second attempt failed.