Using an external database with XWiki
Web Container
Jetty
By default, the standalone XWiki distribution is using Jetty as the web container.
To use an external database for GreenPepper inside this distribution, you will need to :
- Copy the JDBC driver to the directory WEB-INF/lib
- Create a file WEB-INF/jetty-web.xml with the information about the database connectivity (JDBC). This example is defining a MySql database :
<?xml version="1.0"?>
<!DOCTYPE Configure PUBLIC "- "http://jetty.mortbay.org/configure.dtd">
<Configure class="org.mortbay.jetty.webapp.WebAppContext">
<New id="GreenPepperDS" class="org.mortbay.jetty.plus.naming.Resource">
<Arg></Arg>
<Arg>java:comp/env/jdbc/GreenPepperDS</Arg>
<Arg>
<New class="org.apache.commons.dbcp.BasicDataSource">
<Set name="driverClassName">com.mysql.jdbc.Driver</Set>
<Set name="url">jdbc:mysql: <Set name="username">[dbuser]</Set>
<Set name="password">[dbpassword]</Set>
<Set name="maxActive">5</Set>
<Set name="maxIdle">1</Set>
<Set name="maxWait">10000</Set>
</New>
</Arg>
</New>
</Configure>
Others
Follow the guide of your container to setup a JNDI datasource
Configuration
Go to the configuration screen of GreenPepper by clicking the icon
or by browsing to *http://localhost:8080/xwiki/index.greenpepper*
URL (make sure to point to your server host and port!).
Under the Database tab, you will need to use the Custom Installation type, select your database provider and enter the JNDI name of the datasource.
Make sure the Test link is successfull.