Added by Bart van der Schans, last edited by Bartosz Oudekerk on Sep 26, 2008  (view change)

Labels:

repository repository Delete
slide slide Delete
mysql mysql Delete
Enter labels to add to this page:
Wait Image 
Looking for a label? Just start typing.

NOTE: This works with MySQL 4.1.x & 5.x

Sample of a definition.xml for MySQL:

<?xml version="1.0"?>
<definition>
  <store name="default">
    <parameter name="tlock-timeout">120</parameter>
    <parameter name="cache-mode">full</parameter>
    <parameter name="object-cache-size">1000</parameter>
    <parameter name="permission-cache-size">1000</parameter>
    <parameter name="lock-cache-size">100</parameter>

    <parameter name="descriptors-cache-size">10000</parameter>
    <parameter name="descriptor-cache-size">10000</parameter>
    <parameter name="content-cache-size">10000</parameter>
    <parameter name="enable-content-caching">false</parameter>
    <parameter name="tx-content-cache-size">1000</parameter>
    <parameter name="content-cache-bytes">10000000</parameter>

    <parameter name="tx-content-cache-bytes">1000000</parameter>
    <parameter name="max-content-bytes-per-entry">50000</parameter>

    <parameter name="basicQueryClass">org.apache.slide.search.basic.LuceneBasicQuery</parameter>
    <parameter name="basicQueryEnvelopeClass">org.apache.slide.search.basic.LuceneBasicQueryEnvelope</parameter>

    <nodestore classname="org.apache.slide.store.impl.rdbms.JDBCStore">
      <parameter name="adapter">org.apache.slide.store.impl.rdbms.MySql41RDBMSAdapter</parameter>
      <parameter name="driver">com.mysql.jdbc.Driver</parameter>
      <parameter name="url">jdbc:mysql://localhost/slide?characterEncoding=utf8</parameter>

      <parameter name="user">slide</parameter>
      <parameter name="password">secret</parameter>
      <parameter name="dbcpPooling">true</parameter>
      <parameter name="dbcp.testWhileIdle">true</parameter>
      <parameter name="dbcp.timeBetweenEvictionRunsMillis">900000</parameter>
      <parameter name="dbcp.validationQuery">SELECT 1 FROM DUAL</parameter>
      <parameter name="dbcp.maxActive">20</parameter>
      <parameter name="isolation">READ_COMMITTED</parameter>
      <parameter name="compress">false</parameter>

      <parameter name="use-rdbms-expression-factory">true</parameter>
      <parameter name="tlock-timeout">120</parameter>
    </nodestore>
    <contentstore>
      <reference store="nodestore"/>
      <parameter name="tlock-timeout">120</parameter>
    </contentstore>

    <securitystore>
      <reference store="nodestore"/>
    </securitystore>
    <lockstore>
      <reference store="nodestore"/>
    </lockstore>
    <revisiondescriptorsstore>
      <reference store="nodestore"/>
    </revisiondescriptorsstore>

    <revisiondescriptorstore>
      <reference store="nodestore"/>
    </revisiondescriptorstore>
  </store>
  <scope match="/" store="default"/>
</definition>
MySQL 4.1.11+ bug

MySQL 4.1.11 and later is known to have a bug which will sometimes result in strange FK and locking errors. To work around this the following driver url can be used:

jdbc:mysql://localhost/slide?characterEncoding=utf8&amp;useServerPrepStmts=false&amp;jdbcCompliantTruncation=false

More info can be found at the mysql bug page

You can use following setup scripts:

  • create database and user
    CREATE DATABASE slide;
    GRANT ALL PRIVILEGES ON slide.* to slide@localhost IDENTIFIED BY 'secret';
    
  • Import into you MySQL database the following schema: (MySQL41_CreateDatabases.sql)

Don't forget to:

  • Add the MySQL jdbc connector
  • Adapt the build.properties when using MySQL
  • Make sure the MySQL user can connect to the database from the repository server

Optionally add a dependency to the server/project.xml:

    <!-- MySQL driver -->
    <dependency>
      <id>mysql:mysql-connector</id>
      <version>3.1.7</version>
      <properties><fortress.bundle>true</fortress.bundle></properties>
    </dependency>