Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.1.1, 2.1.2
    • Fix Version/s: 2.2.2
    • Component/s: clustering, jackrabbit-core
    • Labels:
      None
    • Environment:
      Persisting the journal to DB2 database

      Description

      Hi guys,

      First of all, congratulations for the fantastic job.

      I'm deploying a Jackrattbit-JCA resource adapter to a clustered Websphere environment and using a DB2 for storing data and realized some missing code to add DB2 support.

      Here is:

      JACKRABBIT-CORE, @ org.apache.jackrabbit.core.util.db, method guessValidationQuery (the last one), I adjusted as follows to add a DB2 validation query:

      ----------------------------------------------------------------------------------------------------------
      private String guessValidationQuery(String url) {
      if (url.contains("derby"))

      { return "values(1)"; }

      else if (url.contains("mysql"))

      { return "select 1"; } else if (url.contains("sqlserver") || url.contains("jtds")) { return "select 1"; }

      else if (url.contains("oracle"))

      { return "select 'validationQuery' from dual"; }

      else if (url.contains("h2"))

      { return "select 1"; }

      else if (url.contains("db2"))

      { return "values(1)"; }

      log.warn("Failed to guess validation query for URL " + url);
      return null;
      ----------------------------------------------------------------------------------------------------------

      And as a final touch, a DDL to build the tables:

      JACKRABBIT-CORE, @ src/main/resources/org/apache/jackrabbit/core/journal, added a file named db2.dll as follows (actually I copied this from derby.dll)

      ----------------------------------------------------------------------------------------------------------

      1. Licensed to the Apache Software Foundation (ASF) under one or more
      2. contributor license agreements. See the NOTICE file distributed with
      3. this work for additional information regarding copyright ownership.
      4. The ASF licenses this file to You under the Apache License, Version 2.0
      5. (the "License"); you may not use this file except in compliance with
      6. the License. You may obtain a copy of the License at
        #
      7. http://www.apache.org/licenses/LICENSE-2.0
        #
      8. Unless required by applicable law or agreed to in writing, software
      9. distributed under the License is distributed on an "AS IS" BASIS,
      10. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
      11. See the License for the specific language governing permissions and
      12. limitations under the License.
        create table $ {schemaObjectPrefix}JOURNAL (REVISION_ID BIGINT NOT NULL, JOURNAL_ID varchar(255), PRODUCER_ID varchar(255), REVISION_DATA blob)
        create unique index ${schemaObjectPrefix}

        JOURNAL_IDX on $

        {schemaObjectPrefix}JOURNAL (REVISION_ID)
        create table ${schemaObjectPrefix}

        GLOBAL_REVISION (REVISION_ID BIGINT NOT NULL)
        create unique index $

        {schemaObjectPrefix}GLOBAL_REVISION_IDX on ${schemaObjectPrefix}

        GLOBAL_REVISION (REVISION_ID)
        create table $

        {schemaObjectPrefix}LOCAL_REVISIONS (JOURNAL_ID varchar(255) NOT NULL, REVISION_ID BIGINT NOT NULL)

        # Inserting the one and only revision counter record now helps avoiding race conditions
        insert into ${schemaObjectPrefix}

        GLOBAL_REVISION VALUES(0)
        ----------------------------------------------------------------------------------------------------------

      Best regards,

      J Marcos

        Activity

        No work has yet been logged on this issue.

          People

          • Assignee:
            Jukka Zitting
            Reporter:
            Jose Marcos Gomes
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development