Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

JNDI Configuration

For both of the configuration configurations above, you may alternatively use JNDI to connect to the MySQL or PostgreSQL databases.

This was accomplished for MySQL with Tomcat 7.0.54 on RHEL 7.2 as follows:  (Note: Fedora web app is deployed as 'fcrepo'.  Database username and password masked.)

  • Define the JNDI resource

          /usr/share/tomcat/conf/Catalina/locahost/fcrepo.xml

 

Code Block
languagexml
<Context path="/fcrepo">
  <Resource name="jdbc/ispn" auth="Container" type="javax.sql.DataSource"
      username="***********" password="*************" driverClassName="com.mysql.jdbc.Driver"
      url="jdbc:mysql://127.0.0.1:3306/ispn?createDatabaseIfNotExist=true"
      factory="org.apache.commons.dbcp.BasicDataSourceFactory" /> 
</Context>
  • Modify Infinispan configuration

                 In inifinispan.xml :

    • Comment out <jdbc:connection-pool /> element.

    • Uncomment <jdbc:data-source /> element and set it as follows (to match the JNDI resource defined above):

Code Block
languagexml
<jdbc:data-source jndi-url="java:comp/env/jdbc/ispn"/>

 

 

Notes for doing that:

  • Add factory="org.apache.commons.dbcp.BasicDataSourceFactory" to the Resource element the fcrepo context file (fcrepo.xml)
  • Set jndi-url="java:comp/env/jdbc/ispn" in the jdbc:data-source element in the infinispan.xml configuration file