AnsweredAssumed Answered

Installing Alfresco 4.2.d

Question asked by smcardle on Sep 23, 2013
Hi All.

I am doing a new install of Alfresco 4.2.d community but with SQL Server 2008.

I have been migrating the SQL create and upgrade scripts for SQL Server since 3.4 but with the 4.2.d I have found a logic problem.

Basically, my 4.2.d create works fine… Everything runs OK.
However, on a restart, I receive Duplicate Key exceptions during the check for patched stage at startup with regards to the Activiti tables.

This is caused by the following code in the SchemaBootstrap.java file:


    private boolean checkActivitiTablesExist(Connection connection)
    {
        Statement stmt = null;
        try
        {
            stmt = connection.createStatement();
            stmt.executeQuery("select min(id_) from ACT_RU_TASK");
            return true;
        }
        catch (SQLException e)
        {
            logger.debug("Did not find ACT_RU_TASK table.");
            return false;
        }
        finally
        {
            try
            {
                if (stmt != null)
                {
                    stmt.close();
                }
            }
            catch (Throwable e) {}
        }
    }



Basically the executeQuery call checks for the min(_id) on the ACT_RU_TASK table to determine if the Activiti tables are present, and if not goes through the patch process.

With SQLServer this will fail and results in the Duplicate Key entry exception as the column names are case SENSITIVE and the actual column name is ID_ and not _id

The code should take care to ensure that in situations like this that the case of the table/column names are consistent. Simply changing _id to ID_ fixes this issue and all is once again rosy in my Alfresco garden :)

Steve

Outcomes