Overview
This document describes how to connect Jive Forums to a JNDI datasource connection.
It is possible for Jive Forums to use a database connection pool built-in to an appserver. There are two ways to go about setting this up:
- If you're starting a new installation of Jive Forums, configuring a JNDI connection pool provider is built into the setup tool. When running the setup tool and configuring your datasource choose "Appserver Datasource" and follow the instructions.
- You can manually configure a connection to a JNDI datasource (see below).
Manually configuring a JNDI datasource
To configure a JNDI connection manually, follow these steps:
- Stop your appserver. You'll be making changes to the jive_startup.xml file and because Jive Forums periodically writes to that file you'll want to stop the appserver while you edit it so your changes won't be overridden.
- Edit the jive_startup.xml file located in your jiveHome directory.
- Add the following section between the jive elements:
<jive>
...
<database>
<JNDIProvider>
<name>java:comp/env/jdbc/MyDataSource<name>
<JNDIProvider>
<database>
<connectionProvider>
<className>com.jivesoftware.base.database.JNDIDataSourceProvider</className>
</connectionProvider>
...
</jive>
This tells Jive Forums to use the JNDI connection provider and the name of the datasource. Note 1: The JNDI connection name (java:comp/env/jdbc/MyDataSource) may vary between appservers. Please consult your appserver's documentation for how to correctly lookup a JNDI datasource.
- Save the jive_startup.xml file and restart your appserver.
Frequently Asked Questions
-
I followed the steps above but it can't find the datasource - what's wrong?
The most likely problem is that your JDNI datasource name is incorrect (ie,
java:comp/env/jdbc/MyDataSource). Please check the following things:
- Consult your appserver documentation. It should be noted how to correctly reference a JNDI datasource.
- If you have other applications that use a JNDI pool, use the same naming scheme those applications use to look up datasources.
- Try removing the java:comp/env/ portion of the name and try again.
-
What do I do if I already have a <database> section in my jive_startup.xml file?
We recommend commenting out the existing
<database> section, especially if you already have a database connection. This allows you to revert back to your old configuration if something goes wrong. To comment something out in the XML file, just wrap the section with <!-- and -->:
<!--
<database>
...
<database>
-->
Once you've done that, just add the new configuration information and save the file.