powered by Jive Software

Changing database connection string within openfire.xml

Is there any way to change the database connection string without going into the web console? I tried to follow Openfire: Custom Database Integration Guide but unsure on how to setup the xml with an existing database and connection provider tag.

Attempted the following:

  1. Stop Openfire service. Added the following tags within openfire.xml then started the service
<jdbcProvider> 
    <driver>net.sourceforge.jtds.jdbc.Driver</driver>  
    <connectionString>jdbc:jtds:sqlserver://<IP Address>/Openfire?user=username;password=secret</connectionString> 
  </jdbcProvider>  
  1. Modified the existing connectionProvider and database tags with the following:
  <connectionProvider> 
    <className>org.jivesoftware.database.DefaultConnectionProvider</className> 
  </connectionProvider>  
  <database> 
    <defaultProvider> 
      <driver>net.sourceforge.jtds.jdbc.Driver</driver>  
      <serverURL>jdbc:jtds:sqlserver://<IP Address>/Openfire?user=username;password=secret</serverURL>  
      <testSQL>select 1</testSQL>  
      <testBeforeUse>false</testBeforeUse>  
      <testAfterUse>false</testAfterUse>  
      <testTimeout>500</testTimeout>  
      <timeBetweenEvictionRuns>30000</timeBetweenEvictionRuns>  
      <minIdleTime>900000</minIdleTime>  
      <maxWaitTime>500</maxWaitTime>  
      <minConnections>5</minConnections>  
      <maxConnections>25</maxConnections>  
      <connectionTimeout>1.0</connectionTimeout> 
    </defaultProvider> 
  </database>  

You were close, but needed to include two tags for the username and password. Look at this MySQL-based example:

  <connectionProvider>
    <className>org.jivesoftware.database.DefaultConnectionProvider</className>
  </connectionProvider>
  <database>
    <defaultProvider>
      <driver>com.mysql.cj.jdbc.Driver</driver>
      <serverURL>jdbc:mysql://localhost:3306/openfire?rewriteBatchedStatements=true&amp;characterEncoding=UTF-8&amp;characterSetResults=UTF-8&amp;serverTimezone=UTC</serverURL>
      <username>THE_DATABASE_USERNAME</username>
      <password>THE_DATABASE_PASSWORD</password>
      <testSQL>select 1</testSQL>
      <testBeforeUse>false</testBeforeUse>
      <testAfterUse>false</testAfterUse>
      <testTimeout>500</testTimeout>
      <timeBetweenEvictionRuns>30000</timeBetweenEvictionRuns>
      <minIdleTime>900000</minIdleTime>
      <maxWaitTime>500</maxWaitTime>
      <minConnections>5</minConnections>
      <maxConnections>25</maxConnections>
      <connectionTimeout>1.0</connectionTimeout>
    </defaultProvider>
  </database>