Configure GateIn to use MySQL

Version 4

    WARN: Deprecated, see the official reference guide.

     

     

    Well, because I just like to, I wanted to get GateIn to use MySQL instead of hsqldb.

     

    There are four (4) files that need changing:

    1. portal/WEB-INF/conf/database/database-configuration.xml
    2. portal/WEB-INF/conf/jcr/repository-configuration.xml
    3. portal/WEB-INF/conf/jcr/jcr-configuration.xml
    4. portal/WEB-INF/conf/organization/idm-configuration.xml

     

    The changes I made (your mileage will vary) are shown below where <NAME> and <PASSWORD> are for you to change for your own site.  Oh yeah, my MySQL database name is "gatein" so you'll also want to change that for your site.

     

    $ diff -wruN portal/WEB-INF/conf/database/database-configuration.xml.orig portal/WEB-INF/conf/database/database-configuration.xml
    --- portal/WEB-INF/conf/database/database-configuration.xml.orig    2009-11-03 09:36:02.865034992 -0600
    +++ portal/WEB-INF/conf/database/database-configuration.xml    2009-11-03 12:44:25.459607451 -0600
    @@ -34,12 +34,12 @@
             <description>Default Hibernate Service</description>
             <property name="hibernate.show_sql" value="false"/>
             <property name="hibernate.cglib.use_reflection_optimizer" value="true"/>
    -        <property name="hibernate.connection.url" value="jdbc:hsqldb:file:../temp/data/exodb${container.name.suffix}"/>
    -        <property name="hibernate.connection.driver_class" value="org.hsqldb.jdbcDriver"/>
    +        <property name="hibernate.connection.url" value="jdbc:mysql://localhost:3306/gatein?relaxAutoCommit=true&amp;autoReconnect=true&amp;useUnicode=true&amp;characterEncoding=latin1"/>
    +        <property name="hibernate.connection.driver_class" value="com.mysql.jdbc.Driver"/>
             <property name="hibernate.connection.autocommit" value="true"/>
    -        <property name="hibernate.connection.username" value="sa"/>
    -        <property name="hibernate.connection.password" value=""/>
    -        <property name="hibernate.dialect" value="org.hibernate.dialect.HSQLDialect"/>
    +        <property name="hibernate.connection.username" value="<NAME>"/>
    +        <property name="hibernate.connection.password" value="<PASSWORD>"/>
    +        <property name="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect"/>
             <property name="hibernate.c3p0.min_size" value="5"/>
             <property name="hibernate.c3p0.max_size" value="20"/>
             <property name="hibernate.c3p0.timeout" value="1800"/>
    @@ -57,7 +57,7 @@
           <init-params>
             <value-param>
               <name>bind-name</name>
    -          <value>jdbcexo${container.name.suffix}</value>
    +          <value>myjdbc${container.name.suffix}</value>
             </value-param>
             <value-param>
               <name>class-name</name>
    @@ -70,10 +70,10 @@
             <properties-param>
               <name>ref-addresses</name>
               <description>ref-addresses</description>
    -          <property name="driverClassName" value="org.hsqldb.jdbcDriver"/>
    -          <property name="url" value="jdbc:hsqldb:file:../temp/data/exodb${container.name.suffix}"/>
    -          <property name="username" value="sa"/>
    -          <property name="password" value=""/>
    +          <property name="driverClassName" value="com.mysql.jdbc.Driver"/>
    +          <property name="url" value="jdbc:mysql://localhost:3306/gatein?relaxAutoCommit=true&amp;autoReconnect=true&amp;useUnicode=true&amp;characterEncoding=latin1"/>
    +          <property name="username" value="<NAME>"/>
    +          <property name="password" value="<PASSWORD>"/>
             </properties-param>
           </init-params>
         </component-plugin>


    $ diff -wruN portal/WEB-INF/conf/jcr/repository-configuration.xml.orig portal/WEB-INF/conf/jcr/repository-configuration.xml
    --- portal/WEB-INF/conf/jcr/repository-configuration.xml.orig    2009-11-03 10:01:08.254857530 -0600
    +++ portal/WEB-INF/conf/jcr/repository-configuration.xml    2009-11-03 11:09:14.270617247 -0600
    @@ -29,8 +29,8 @@
                   <workspace name="system">
                         <container class="org.exoplatform.services.jcr.impl.storage.jdbc.JDBCWorkspaceDataContainer">
                           <properties>
    -                        <property name="source-name" value="jdbcexo${container.name.suffix}"/>
    -                        <property name="dialect" value="hsqldb"/>
    +                        <property name="source-name" value="myjdbc${container.name.suffix}"/>
    +                        <property name="dialect" value="mysql"/>
                             <property name="multi-db" value="false"/>
                             <property name="update-storage" value="true"/>
                             <property name="max-buffer-size" value="204800"/>
    @@ -76,8 +76,8 @@
                     <workspace name="portal-system">
               <container class="org.exoplatform.services.jcr.impl.storage.jdbc.JDBCWorkspaceDataContainer">
                 <properties>
    -              <property name="source-name" value="jdbcexo${container.name.suffix}"/>
    -              <property name="dialect" value="hsqldb"/>
    +              <property name="source-name" value="myjdbc${container.name.suffix}"/>
    +              <property name="dialect" value="mysql"/>
                   <property name="multi-db" value="false"/>
                   <property name="update-storage" value="true"/>
                   <property name="max-buffer-size" value="204800"/>
    @@ -123,8 +123,8 @@
                     <workspace name="gadgets">
               <container class="org.exoplatform.services.jcr.impl.storage.jdbc.JDBCWorkspaceDataContainer">
                 <properties>
    -              <property name="source-name" value="jdbcexo${container.name.suffix}"/>
    -              <property name="dialect" value="hsqldb"/>
    +              <property name="source-name" value="myjdbc${container.name.suffix}"/>
    +              <property name="dialect" value="mysql"/>
                   <property name="multi-db" value="false"/>
                   <property name="update-storage" value="true"/>
                   <property name="max-buffer-size" value="204800"/>


    $ diff -wruN portal/WEB-INF/conf/jcr/jcr-configuration.xml.orig portal/WEB-INF/conf/jcr/jcr-configuration.xml
    --- portal/WEB-INF/conf/jcr/jcr-configuration.xml.orig    2009-11-03 10:00:55.918610642 -0600
    +++ portal/WEB-INF/conf/jcr/jcr-configuration.xml    2009-11-03 11:09:02.455610908 -0600
    @@ -37,8 +37,8 @@
             <name>working-conf</name>
             <description>working-conf</description>
             <property name="persister-class-name" value="org.exoplatform.services.jcr.impl.config.JDBCConfigurationPersister"/>
    -        <property name="source-name" value="jdbcexo${container.name.suffix}"/>
    -        <property name="dialect" value="hsqldb"/>
    +        <property name="source-name" value="myjdbc${container.name.suffix}"/>
    +        <property name="dialect" value="mysql"/>
           </properties-param>
         </init-params>
       </component>


    $ diff -wruN  portal/WEB-INF/conf/organization/idm-configuration.xml.orig portal/WEB-INF/conf/organization/idm-configuration.xml
    --- portal/WEB-INF/conf/organization/idm-configuration.xml.orig    2009-11-03 10:54:16.290631636 -0600
    +++ portal/WEB-INF/conf/organization/idm-configuration.xml    2009-11-03 12:42:44.825864322 -0600
    @@ -53,12 +53,12 @@
                 <property name="hibernate.current_session_context_class" value="thread"/>
                 <property name="hibernate.show_sql" value="false"/>
                 <property name="hibernate.cglib.use_reflection_optimizer" value="true"/>
    -            <property name="hibernate.connection.url" value="jdbc:hsqldb:file:../temp/data/exodb${container.name.suffix}"/>
    -            <property name="hibernate.connection.driver_class" value="org.hsqldb.jdbcDriver"/>
    +            <property name="hibernate.connection.url" value="jdbc:mysql://localhost:3306/gatein?relaxAutoCommit=true&amp;autoReconnect=true&amp;useUnicode=true&amp;characterEncoding=latin1"/>
    +            <property name="hibernate.connection.driver_class" value="com.mysql.jdbc.Driver"/>
                 <property name="hibernate.connection.autocommit" value="true"/>
    -            <property name="hibernate.connection.username" value="sa"/>
    -            <property name="hibernate.connection.password" value=""/>
    -            <property name="hibernate.dialect" value="org.hibernate.dialect.HSQLDialect"/>
    +            <property name="hibernate.connection.username" value="<NAME>"/>
    +            <property name="hibernate.connection.password" value="<PASSWORD>"/>
    +            <property name="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect"/>
                 <property name="hibernate.c3p0.min_size" value="5"/>
                 <property name="hibernate.c3p0.max_size" value="20"/>
                 <property name="hibernate.c3p0.timeout" value="1800"/>