Use Confluence Play SQL Plug-in with MySQL

Play SQL is a an Atlassian Confluence plug-in for querying database tables and displaying the results inside a Confluence page. The plug-in has only native support for PostgreSQL and HSQL but other drivers can be used via a JNDI datasource.

For using MySQL with Play SQL you have to download the latest MySQL JDBC driver and extract the .jar file to your confluence/lib directory as the Tomcat container searches this path for additional libraries. Now register the new JNDI datasource by adding the following code to your confluence/conf/server.xml:

<pre>
  <Engine name="Standalone" defaultHost="localhost" debug="0">
    <Host name="localhost" debug="0" appBase="webapps" unpackWARs="true" autoDeploy="false">
      <Context path="" docBase="../confluence" debug="0" reloadable="false" useHttpOnly="true">
        <Resource
          name="jdbc/my_datasource"
          auth="Container"
          type="javax.sql.DataSource"
          url="jdbc:mysql://${SERVER}/${DATABASE}?user=${DATABASE}&amp;password=${PASSWORD}"
          driverClassName="org.gjt.mm.mysql.Driver"
          maxActive="20" maxIdle="10" maxWait="20000" />

          <Manager pathname="" />
      </Context>
    </Host>
  </Engine>
</pre>

Restart your Confluence instance (/etc/init.d/confluence restart) and open Play SQL configuration page inside the Confluence administration page. Change the Global Connection to Type: Use JNDI connection, Dialect: Generic and JNDI Name: java:comp/env/jdbc/my_datasource.
That’s it.

Leave a reply

Your email address will not be published.

You may use these HTML tags and attributes:

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>