Migration from Oracle to Postgres fails with—Protocol violation: [ 14, 116, ]

Still need help?

The Atlassian Community is here for you.

Ask the community

Summary

A database migration from Oracle to PostgreSQL could fail with the following errors preventing the migration from succeeding.

Problem

Database migration from Oracle to Postgres fails and the following is found in the atlassian-fisheye-YYYY-MM-DD.log:

2020-08-08 14:00:45,688 ERROR [ThreadPool1 ] fisheye DBEditHelper-doGet - Database migration failed: java.sql.SQLException: Protocol violation: [ 14, 116, ]
java.sql.SQLException: Protocol violation: [ 14, 116, ]
    at oracle.jdbc.driver.T4CTTIfun.receive(T4CTTIfun.java:669) [ojdbc7-12.1.0.1.jar:12.1.0.1.0]
    at oracle.jdbc.driver.T4CTTIfun.doRPC(T4CTTIfun.java:249) [ojdbc7-12.1.0.1.jar:12.1.0.1.0]
    at oracle.jdbc.driver.T4C8TTIClob.read(T4C8TTIClob.java:245) [ojdbc7-12.1.0.1.jar:12.1.0.1.0]
    at oracle.jdbc.driver.T4CConnection.getChars(T4CConnection.java:3901) [ojdbc7-12.1.0.1.jar:12.1.0.1.0]
    at oracle.sql.CLOB.getChars(CLOB.java:517) [ojdbc7-12.1.0.1.jar:12.1.0.1.0]
    at oracle.sql.CLOB.getSubString(CLOB.java:354) [ojdbc7-12.1.0.1.jar:12.1.0.1.0]
    at oracle.jdbc.driver.ClobAccessor.getString(ClobAccessor.java:454) [ojdbc7-12.1.0.1.jar:12.1.0.1.0]
    at oracle.jdbc.driver.GeneratedStatement.getString(GeneratedStatement.java:327) [ojdbc7-12.1.0.1.jar:12.1.0.1.0]
    at oracle.jdbc.driver.GeneratedScrollableResultSet.getString(GeneratedScrollableResultSet.java:882) [ojdbc7-12.1.0.1.jar:12.1.0.1.0]
    at com.atlassian.crucible.migration.item.DBExporter$OracleColumnExporter.export(DBExporter.java:271) [fisheye.jar:?]
    at com.atlassian.crucible.migration.item.DBExporter.exportRow(DBExporter.java:361) [fisheye.jar:?]
    at com.atlassian.crucible.migration.item.DBExporter.exportTable(DBExporter.java:164) [fisheye.jar:?]
    at com.atlassian.crucible.migration.item.DBExporter.exportData(DBExporter.java:103) [fisheye.jar:?]
    at com.atlassian.crucible.actions.admin.database.DBEditHelper$ExportRunner.call(DBEditHelper.java:120) [fisheye.jar:?]
    at com.atlassian.crucible.actions.admin.database.DBEditHelper$ExportRunner.call(DBEditHelper.java:99) [fisheye.jar:?]
    at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:1.8.0_252]
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180) [?:1.8.0_252]
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293) [?:1.8.0_252]
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:1.8.0_252]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:1.8.0_252]
    at java.lang.Thread.run(Thread.java:748) [?:1.8.0_252]

And

2020-08-08 14:00:45,972 ERROR [ThreadPool1 ] fisheye DBEditHelper-doGet - Database migration failed: com.cenqua.crucible.hibernate.CruDBException: Problem with constraints script <FISHEYE_HOME>/sql/POSTGRESQL/schema/constraints_108.sql
com.cenqua.crucible.hibernate.CruDBException: Problem with constraints script <FISHEYE_HOME>/sql/POSTGRESQL/schema/constraints_108.sql
    at com.cenqua.crucible.hibernate.DefaultDBControl.addConstraints(DefaultDBControl.java:377) [fisheye.jar:?]
    at com.atlassian.crucible.migration.item.DBImporter.importData(DBImporter.java:145) [fisheye.jar:?]
    at com.atlassian.crucible.actions.admin.database.DBEditHelper$ImportRunner.call(DBEditHelper.java:91) [fisheye.jar:?]
    at com.atlassian.crucible.actions.admin.database.DBEditHelper$ImportRunner.call(DBEditHelper.java:73) [fisheye.jar:?]
    at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:1.8.0_252]
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180) [?:1.8.0_252]
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293) [?:1.8.0_252]
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:1.8.0_252]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:1.8.0_252]
    at java.lang.Thread.run(Thread.java:748) [?:1.8.0_252]
Caused by: com.cenqua.crucible.hibernate.CruDBException: SQL script error on line 4: "alter table cru_comment add constraint FKE5A1D10674DF349C foreign key (cru_reply_to_comment_id) references cru_comment;" 
    (ERROR: insert or update on table "cru_comment" violates foreign key constraint "fke5a1d10674df349c"
      Detail: Key (cru_reply_to_comment_id)=(418841) is not present in table "cru_comment".), please contact http://www.atlassian.com/support/
    at com.cenqua.crucible.hibernate.DefaultDBControl.executeScript(DefaultDBControl.java:595) [fisheye.jar:?]
    at com.cenqua.crucible.hibernate.DefaultDBControl.executeScript(DefaultDBControl.java:524) [fisheye.jar:?]
    at com.cenqua.crucible.hibernate.DefaultDBControl.addConstraints(DefaultDBControl.java:371) [fisheye.jar:?]
    ... 9 more
Caused by: org.postgresql.util.PSQLException: ERROR: insert or update on table "cru_comment" violates foreign key constraint "fke5a1d10674df349c"
      Detail: Key (cru_reply_to_comment_id)=(418841) is not present in table "cru_comment".
    at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2468) [postgresql-42.2.6.jar:42.2.6]
    at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:2211) [postgresql-42.2.6.jar:42.2.6]
    at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:309) [postgresql-42.2.6.jar:42.2.6]
    at org.postgresql.jdbc.PgStatement.executeInternal(PgStatement.java:446) [postgresql-42.2.6.jar:42.2.6]
    at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:370) [postgresql-42.2.6.jar:42.2.6]
    at org.postgresql.jdbc.PgStatement.executeWithFlags(PgStatement.java:311) [postgresql-42.2.6.jar:42.2.6]
    at org.postgresql.jdbc.PgStatement.executeCachedSql(PgStatement.java:297) [postgresql-42.2.6.jar:42.2.6]
    at org.postgresql.jdbc.PgStatement.executeWithFlags(PgStatement.java:274) [postgresql-42.2.6.jar:42.2.6]
    at org.postgresql.jdbc.PgStatement.executeUpdate(PgStatement.java:246) [postgresql-42.2.6.jar:42.2.6]
    at com.cenqua.crucible.hibernate.DefaultDBControl.executeScript(DefaultDBControl.java:566) [fisheye.jar:?]
    ... 11 more

Diagnosis

Environment

Your Fisheye 4.8.X instance is configured to use Oracle ojdbc7.jar version 12.1.0.1 to connect to Oracle 12c Database.

Cause

This issue is caused by the JDBC driver ojdbc7 version 12.1.0.1, while reading a clob data of length 4193 that is selected from a table in a UTF-8/AL32UTF8 Oracle database.



Resolution

Update the JDBC driver to ojdbc8-12.2.0.1

  1. Download the ojdbc8-12.2.0.1 driver;
  2. Move the driver to <FISHEYE_INST>/lib (Create the folder if it doesn't exist);
  3. Restart the application;
  4. Try the database migration again.

Additional information on how to perform a database migration to PostgreSQL can be found at article below

Migrating to PostgreSQL






Last modified on Sep 12, 2020

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.