Uploaded image for project: 'Jira Data Center'
  1. Jira Data Center
  2. JRASERVER-27846

JIRA 4.4 does not work with schema name 'JIRA' in SQL Server, problem being the caps

    XMLWordPrintable

Details

    Description

      This bug relates to JRA-25270

      The bug was fixed, but there is still a problem when upgrading with the specific schema 'JIRA', note the caps.

      Tests:
      Startup 1:
      • created database tables are using the schema 'JIRA', upper case
      • jira's dbconfig.xml file is also defined as 'JIRA'
      • Even though jira is defined with the matching schema, it still resulted in:
        2012-04-10 11:58:29,182 main INFO      [jira.config.database.DatabaseConfigurationManagerImpl] Now running Database Checklist Launcher
        2012-04-10 11:58:33,750 main WARN      [core.entity.jdbc.DatabaseUtil] Entity "Action" has no table in the database
        2012-04-10 11:58:33,776 main ERROR      [core.entity.jdbc.DatabaseUtil] Could not create table "JIRA.jiraaction"
        2012-04-10 11:58:33,778 main ERROR      [core.entity.jdbc.DatabaseUtil] SQL Exception while executing the following:
        CREATE TABLE JIRA.jiraaction (ID NUMERIC NOT NULL, issueid NUMERIC, AUTHOR NVARCHAR(255), actiontype NVARCHAR(255), actionlevel NVARCHAR(255), rolelevel NUMERIC, actionbody NTEXT, CREATED DATETIME, UPDATEAUTHOR NVARCHAR(255), UPDATED DATETIME, actionnum NUMERIC, CONSTRAINT PK_jiraaction PRIMARY KEY (ID))
        Error was: java.sql.SQLException: There is already an object named 'jiraaction' in the database.
        
      Startup 2:
      • In SQL Server, I altered all the database tables to use the schema 'jira', lowercase
      • modified jira's dbconfig.xml file to also be defined as 'jira'
      • This resulted in:
        2012-04-10 13:01:01,836 main WARN      [core.entity.jdbc.DatabaseUtil] Entity "Issue" has 25 fields but table "jira.jiraissue" has 24 columns.
        2012-04-10 13:01:01,838 main WARN      [core.entity.jdbc.DatabaseUtil] Field "watches" of entity "Issue" is missing its corresponding column "WATCHES"
        
      • Upgrade went smoothly

      Andreas has confirmed the problem to be here:
      DatabaseUtil from com.atlassian.ofbiz:entityengine:1.0.22 contains this code on line 2321:

      // Check if the table name does not start with the shema name
                  if (this.datasourceInfo.getSchemaName() != null && this.datasourceInfo.getSchemaName().length() > 0 && !tableName.startsWith(this.datasourceInfo.getSchemaName()))
                  {
                      // Prepend the schema name
                      return this.datasourceInfo.getSchemaName().toUpperCase() + "." + tableName;
                  }
      

      It should be:

      // Check if the table name does not start with the shema name
                  if (this.datasourceInfo.getSchemaName() != null && this.datasourceInfo.getSchemaName().length() > 0 && !tableName.startsWith(this.datasourceInfo.getSchemaName() + "."))
                  {
                      // Prepend the schema name
                      return this.datasourceInfo.getSchemaName().toUpperCase() + "." + tableName;
                  }
      

      Attachments

        Activity

          People

            rsmart metapoint
            dchan David Chan
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: