Uploaded image for project: 'PUBLIC - Liferay Portal Community Edition'
  1. PUBLIC - Liferay Portal Community Edition
  2. LPS-79478

DBInspector getSchema() method does not work as expected for Oracle ojdbc6 driver

    Details

    • Fix Priority:
      1

      Description

      When working with Oracle databases, DBInspector getSchema() method retrieves all database schemas the db user configured has access to, no matter how the connection (jdbc.default.url) has been configured. This is because connection.getSechema() throws a java.lang.AbstractMethodError error due to an incompatibility with ojdbc6 driver and Java >= 7, so a null is returned.

      The above (passing a null schema to the methods using getSchema() - such as getTables, hasColumn, etc) seems to be the reason that if the user has access to several schemas, they will find the tables among all of them. This will cause trouble during the upgrade process, for example*:*

      Adding the companyId column to different db tables when upgrading the portal from 6.2 to 7.0 is an example where this is reflected: before adding the column, the hasColumn method is executed to check if it previously existed. 

      These are the steps you must follow to check the consequences of the upgrade example described above:

      1. Configure portal-upgrade-database.properties with the following:
        • 6.2 Oracle database.
        • User that has permissions over a 6.2 database and a 7.0 database.
      2. Execute the upgrade proccess: one of the steps is adding the column companyId to the Users_Groups table.
      3. When the proccess finishes, check with a DB tool that the Users_Groups table has been added the companyId column.

      Expected result : The upgrade process adds the companyId column to the table User_Groups, as the configured 6.2 database did not include it in this table.

      Current result : The new column is not added to the upgraded database. This is because the Users_Groups 7.0 table (which the user also has access to) has it already, and hasColumn method, which uses getSchema, returns true. The following trace is present in the logs:

      INFO  [pool-1-thread-26][UpgradeCompanyId:116] Skipping the creation of companyId column for table Users_Groups

        Attachments

          Activity

            People

            Assignee:
            cristina.rodriguez Cristina Rodriguez
            Reporter:
            cristina.rodriguez Cristina Rodriguez
            Participants of an Issue:
            Recent user:
            Marta Elicegui
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated:
              Days since last comment:
              3 years, 28 weeks, 1 day ago

                Packages

                Version Package