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.

I am asking you for a donation.

You liked the content or this article has helped and reduced the amount of time you have struggled with this issue? Please donate a few bucks so I can keep going with solving challenges.


0 Comments

Leave a Reply