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:
- 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.
- Execute the upgrade proccess: one of the steps is adding the column companyId to the Users_Groups table.
- 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: