Database storage configuration

This page explains how to configure JSpider with MKSearch to use MySQL or PostgreSQL to store index triple statements. It also explains how to configure the servlet context to query the database store.

The configuration parameter names for database storage are common to JSpider indexing and servlet configuration, as follows.

dbVendor
Accepted values: mysql or pgsql for MySQL or PostgreSQL respectively.
dbName
The name of the database that will be used to store the indexed triple statements and submit queries.
dbUser
A database user name that corresponds with the named database.
dbPass
The database password that corresponds with the relevant user name.

JDBC drivers for MySQL and PostgreSQL

The JDBC driver for the relevant database must be available to the Java Virtual Machine at runtime. The drivers for MySQL and PostgreSQL are included in the MKSearch $mk_home/lib-opt directory:

JSpider classpath setting

To use database storage for JSpider indexing, add the database driver to the relevant script in the $mk_home/bin directory. A set of scripts is included in the standard MKSearch distribution, as follows:

$mk_home/bin/gij-jspider-mysql.sh
$mk_home/bin/gij-jspider-pgsql.sh
$mk_home/bin/java-jspider-mysql.sh
$mk_home/bin/java-jspider-pgsql.sh
$mk_home/bin/java-jspider-mysql.bat
$mk_home/bin/java-jspider-pgsql.bat

JDBC drivers for Tomcat

To build the relevant JDBC driver into the MKSearch WAR file, place a copy of the JAR file in the Web application library directory at: $mk_home/src/app/WEB-INF/lib

Re-build the WAR using the instructions in Tomcat on FC4.

JSpider database storage configuration

A sample database configuration is included at $mk_home/conf/rdfstoredb that targets a PostgreSQL database called mksearch_test.

Database store manager class

The StoreManager type that handles database storage is com.mkdoc.store.DatabaseStoreManager, which is configured with the following line:

plugin.config.manager=com.mkdoc.store.DatabaseStoreManager

Database configuration parameters

JSpider plugin configuration parameters are prefixed plugin.config., followed by the database parameter name, as below:

plugin.config.dbVendor=pgsql
plugin.config.dbName=mksearch_test
plugin.config.dbUser=Phil
plugin.config.dbPass=

Tomcat database storage configuration

Tomcat should be configured with the same database storage class as with JSpider, com.mkdoc.store.DatabaseStoreManager. The sample application configuration file at $mk_home/src/app/WEB-INF/web.xml includes an example configuration that is commented out. To switch to a database configuration, comment out the default file based store configuration, below:

<!-- File based store configuration

     Comment out to switch to database storage -->

  <context-param>
    <param-name>repository</param-name>
    <param-value>com.mkdoc.store.LocalStoreManager.rdf</param-value>
  </context-param>
  <context-param>
    <param-name>manager</param-name>
    <param-value>com.mkdoc.store.LocalStoreManager</param-value>
  </context-param>

<!-- Ends file based store configuration -->

And un-comment the database configuration:

<context-param>
  <param-name>manager</param-name>
  <param-value>com.mkdoc.store.DatabaseStoreManager</param-value>
</context-param>
<context-param>
  <param-name>dbVendor</param-name>
  <param-value>pgsql</param-value>
</context-param>
<context-param>
  <param-name>dbName</param-name>
  <param-value>mksearch_test</param-value>
</context-param>
<context-param>
  <param-name>dbUser</param-name>
  <param-value>Phil</param-value>
</context-param>
<context-param>
  <param-name>dbPass</param-name>
  <param-value></param-value>
</context-param>

After modifying the source configuration, re-build the WAR using the instructions in Tomcat on FC4.

Document Links

Tomcat on FC4
MKSearch configuration for Tomcat on Fedora Core 4
http://mksearch.mkdoc.org.archived.website/documentation/tomcat-on-fc4/
This document was last modified on 2006-01-10 10:06:40.
Copyright MKDoc Ltd. and others.
The Free Documentation License http://www.gnu.org/copyleft/fdl.html