Menu

Database changes

This page is generated by Machine Translation from Japanese.

Overview

Provides binaries to use H2 Database with MySQL database. You can use the other database in to change the settings using the source code and build it.

If you use the MySQL

Preparation

The MySQL character code setting. /etc/mysql/my.cnf and the added must have the following settings.

[mysqld]
character-set-server = utf8 # mysql 5.5 以降
# default-character-set = utf8 mysql 5.1以下

Installation

Download MySQL binaries and expand.

Setting

Create a database.

$ mysql -u root -p
mysql> create database fess_db;
mysql> grant all privileges on fess_db.* to fess_user@localhost identified by 'fess_pass';
mysql> create database fess_robot;
mysql> grant all privileges on fess_robot.* to s2robot@localhost identified by 's2robot';
mysql> FLUSH PRIVILEGES;

Create a table in the database. DDL file is located in extension/mysql.

$ mysql -u fess_user --password=fess_pass fess_db < extension/mysql/fess.ddl
$ mysql -u s2robot --password=s2robot fess_robot < extension/mysql/robot.ddl

webapps/fess/WEB-INF/lib on mysql driver jar.

$ cd webapps/fess/WEB-INF/lib/
$ rm h2-1.*.jar
$ wget http://mirrors.ibiblio.org/pub/mirrors/maven2/mysql/mysql-connector-java/5.1.18/ \
mysql-connector-java-5.1.18.jar
$ cd ../../../../

Edit the webapps/fess/WEB-INF/classes/jdbc.dicon.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE components PUBLIC "-//SEASAR2.1//DTD S2Container//EN"
    "http://www.seasar.org/dtd/components21.dtd">
<components namespace="jdbc">
    <include path="jta.dicon"/>

    <!-- MySQL -->
    <component name="xaDataSource"
        class="org.seasar.extension.dbcp.impl.XADataSourceImpl">
        <property name="driverClassName">
            "com.mysql.jdbc.Driver"
        </property>
        <property name="URL">
            "jdbc:mysql://localhost:3306/fess_db?" +
            "noDatetimeStringSync=true&amp;" +
            "zeroDateTimeBehavior=convertToNull&amp;" +
            "useUnicode=true&amp;characterEncoding=UTF-8&amp;" +
            "autoReconnect=true"
        </property>
        <property name="user">"fess_user"</property>
        <property name="password">"fess_pass"</property>
    </component>

    <component name="connectionPool"
        class="org.seasar.extension.dbcp.impl.ConnectionPoolImpl">
        <property name="timeout">600</property>
        <property name="maxPoolSize">10</property>
        <property name="allowLocalTx">true</property>
        <destroyMethod name="close"/>
    </component>

    <component name="DataSource"
        class="org.seasar.extension.dbcp.impl.DataSourceImpl"
    />
</components>

Edit the webapps/fess/WEB-INF/classes/s2robot_jdbc.dicon.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE components PUBLIC "-//SEASAR2.1//DTD S2Container//EN"
    "http://www.seasar.org/dtd/components21.dtd">
<components namespace="jdbc">
    <include path="jta.dicon"/>

    <!-- for MySQL -->
    <component name="xaDataSource"
        class="org.seasar.extension.dbcp.impl.XADataSourceImpl">
        <property name="driverClassName">
            "com.mysql.jdbc.Driver"
        </property>
        <property name="URL">
            "jdbc:mysql://localhost:3306/fess_robot?" +
            "noDatetimeStringSync=true&amp;" +
            "zeroDateTimeBehavior=convertToNull&amp;" +
            "useUnicode=true&amp;characterEncoding=UTF-8&amp;" +
            "autoReconnect=true"
        </property>
        <property name="user">"s2robot"</property>
        <property name="password">"s2robot"</property>
    </component>

    <component name="connectionPool"
        class="org.seasar.extension.dbcp.impl.ConnectionPoolImpl">
        <property name="timeout">600</property>
        <property name="maxPoolSize">10</property>
        <property name="allowLocalTx">true</property>
        <property name="transactionIsolationLevel">
            @java.sql.Connection@TRANSACTION_REPEATABLE_READ</property>
        <destroyMethod name="close"/>
    </component>

    <component name="DataSource"
        class="org.seasar.extension.dbcp.impl.DataSourceImpl"
    />

</components>