Uploaded image for project: 'Derby'
  1. Derby
  2. DERBY-3744

User-coded functions can't return Blob or Clob because these raise connection-killing errors in the byte-code compiler

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Duplicate
    • Affects Version/s: 10.5.1.1
    • Fix Version/s: None
    • Component/s: SQL
    • Labels:
      None

      Description

      User-coded functions which return Blob or Clob choke the byte-code compiler. When trying to invoke a user-coded function which returns a Blob, you see the following error and the connection becomes unusable:

      java.lang.NoSuchMethodException: org.apache.derby.iapi.types.DataValueFactory.getBlobDataValue(java.sql.Blob, org.apache.derby.iapi.types.BitDataValue)
      at java.lang.Class.getDeclaredMethod(Class.java:1909)
      at org.apache.derby.impl.services.bytecode.d_BCValidate.checkMethod(d_BCValidate.java:132)
      at org.apache.derby.impl.services.bytecode.BCMethod.callMethod(BCMethod.java:745)
      at org.apache.derby.impl.sql.compile.BaseTypeCompiler.generateDataValue(BaseTypeCompiler.java:187)
      at org.apache.derby.impl.sql.compile.ExpressionClassBuilder.generateDataValue(ExpressionClassBuilder.java:899)
      at org.apache.derby.impl.sql.compile.JavaToSQLValueNode.generateExpression(JavaToSQLValueNode.java:170)
      at org.apache.derby.impl.sql.compile.CastNode.generateExpression(CastNode.java:851)
      at org.apache.derby.impl.sql.compile.SQLToJavaValueNode.generateSQLValue(SQLToJavaValueNode.java:352)
      at org.apache.derby.impl.sql.compile.SQLToJavaValueNode.generateExpression(SQLToJavaValueNode.java:332)
      at org.apache.derby.impl.sql.compile.JavaToSQLValueNode.generateExpression(JavaToSQLValueNode.java:167)
      at org.apache.derby.impl.sql.compile.ResultColumn.generateExpression(ResultColumn.java:893)
      at org.apache.derby.impl.sql.compile.ResultColumnList.generateCore(ResultColumnList.java:1193)
      at org.apache.derby.impl.sql.compile.ResultColumnList.generate(ResultColumnList.java:1028)
      at org.apache.derby.impl.sql.compile.RowResultSetNode.generate(RowResultSetNode.java:690)
      at org.apache.derby.impl.sql.compile.ScrollInsensitiveResultSetNode.generate(ScrollInsensitiveResultSetNode.java:109)
      at org.apache.derby.impl.sql.compile.CursorNode.generate(CursorNode.java:564)
      at org.apache.derby.impl.sql.compile.StatementNode.generate(StatementNode.java:347)
      at org.apache.derby.impl.sql.GenericStatement.prepMinion(GenericStatement.java:447)
      at org.apache.derby.impl.sql.GenericStatement.prepare(GenericStatement.java:88)
      at org.apache.derby.impl.sql.conn.GenericLanguageConnectionContext.prepareInternalStatement(GenericLanguageConnectionContext.java:794)
      at org.apache.derby.impl.jdbc.EmbedStatement.execute(EmbedStatement.java:606)
      at org.apache.derby.impl.jdbc.EmbedStatement.execute(EmbedStatement.java:555)
      at org.apache.derby.impl.tools.ij.ij.executeImmediate(ij.java:329)
      at org.apache.derby.impl.tools.ij.utilMain.doCatch(utilMain.java:508)
      at org.apache.derby.impl.tools.ij.utilMain.runScriptGuts(utilMain.java:350)
      at org.apache.derby.impl.tools.ij.utilMain.go(utilMain.java:248)
      at org.apache.derby.impl.tools.ij.Main.go(Main.java:215)
      at org.apache.derby.impl.tools.ij.Main.mainCore(Main.java:181)
      at org.apache.derby.impl.tools.ij.Main.main(Main.java:73)
      at org.apache.derby.tools.ij.main(ij.java:59)
      Invalid method org.apache.derby.iapi.types.DataValueFactory >> org.apache.derby.iapi.types.BitDataValue getBlobDataValue(java.sql.Blob, org.apache.derby.iapi.types.BitDataValue) because java.lang.NoSuchMethodException: org.apache.derby.iapi.types.DataValueFactory.getBlobDataValue(java.sql.Blob, org.apache.derby.iapi.types.BitDataValue)
      ERROR XJ001: Java exception: 'ASSERT FAILED Invalid method org.apache.derby.iapi.types.DataValueFactory >> org.apache.derby.iapi.types.BitDataValue getBlobDataValue(java.sql.Blob, org.apache.derby.iapi.types.BitDataValue) because java.lang.NoSuchMethodException: org.apache.derby.iapi.types.DataValueFactory.getBlobDataValue(java.sql.Blob, org.apache.derby.iapi.types.BitDataValue): org.apache.derby.shared.common.sanity.AssertFailure'.

      Similarly, if you invoke a user-coded function which returns a Clob, you see the following error and the connection becomes unusable:

      java.lang.NoSuchMethodException: org.apache.derby.iapi.types.DataValueFactory.getClobDataValue(java.sql.Clob, org.apache.derby.iapi.types.StringDataValue)
      at java.lang.Class.getDeclaredMethod(Class.java:1909)
      at org.apache.derby.impl.services.bytecode.d_BCValidate.checkMethod(d_BCValidate.java:132)
      at org.apache.derby.impl.services.bytecode.BCMethod.callMethod(BCMethod.java:745)
      at org.apache.derby.impl.sql.compile.BaseTypeCompiler.generateDataValue(BaseTypeCompiler.java:187)
      at org.apache.derby.impl.sql.compile.ExpressionClassBuilder.generateDataValue(ExpressionClassBuilder.java:899)
      at org.apache.derby.impl.sql.compile.JavaToSQLValueNode.generateExpression(JavaToSQLValueNode.java:170)
      at org.apache.derby.impl.sql.compile.CastNode.generateExpression(CastNode.java:851)
      at org.apache.derby.impl.sql.compile.SQLToJavaValueNode.generateSQLValue(SQLToJavaValueNode.java:352)
      at org.apache.derby.impl.sql.compile.SQLToJavaValueNode.generateExpression(SQLToJavaValueNode.java:332)
      at org.apache.derby.impl.sql.compile.JavaToSQLValueNode.generateExpression(JavaToSQLValueNode.java:167)
      at org.apache.derby.impl.sql.compile.ResultColumn.generateExpression(ResultColumn.java:893)
      at org.apache.derby.impl.sql.compile.ResultColumnList.generateCore(ResultColumnList.java:1193)
      at org.apache.derby.impl.sql.compile.ResultColumnList.generate(ResultColumnList.java:1028)
      at org.apache.derby.impl.sql.compile.RowResultSetNode.generate(RowResultSetNode.java:690)
      at org.apache.derby.impl.sql.compile.ScrollInsensitiveResultSetNode.generate(ScrollInsensitiveResultSetNode.java:109)
      at org.apache.derby.impl.sql.compile.CursorNode.generate(CursorNode.java:564)
      at org.apache.derby.impl.sql.compile.StatementNode.generate(StatementNode.java:347)
      at org.apache.derby.impl.sql.GenericStatement.prepMinion(GenericStatement.java:447)
      at org.apache.derby.impl.sql.GenericStatement.prepare(GenericStatement.java:88)
      at org.apache.derby.impl.sql.conn.GenericLanguageConnectionContext.prepareInternalStatement(GenericLanguageConnectionContext.java:794)
      at org.apache.derby.impl.jdbc.EmbedStatement.execute(EmbedStatement.java:606)
      at org.apache.derby.impl.jdbc.EmbedStatement.execute(EmbedStatement.java:555)
      at org.apache.derby.impl.tools.ij.ij.executeImmediate(ij.java:329)
      at org.apache.derby.impl.tools.ij.utilMain.doCatch(utilMain.java:508)
      at org.apache.derby.impl.tools.ij.utilMain.runScriptGuts(utilMain.java:350)
      at org.apache.derby.impl.tools.ij.utilMain.go(utilMain.java:248)
      at org.apache.derby.impl.tools.ij.Main.go(Main.java:215)
      at org.apache.derby.impl.tools.ij.Main.mainCore(Main.java:181)
      at org.apache.derby.impl.tools.ij.Main.main(Main.java:73)
      at org.apache.derby.tools.ij.main(ij.java:59)
      Invalid method org.apache.derby.iapi.types.DataValueFactory >> org.apache.derby.iapi.types.StringDataValue getClobDataValue(java.sql.Clob, org.apache.derby.iapi.types.StringDataValue) because java.lang.NoSuchMethodException: org.apache.derby.iapi.types.DataValueFactory.getClobDataValue(java.sql.Clob, org.apache.derby.iapi.types.StringDataValue)
      ERROR XJ001: Java exception: 'ASSERT FAILED Invalid method org.apache.derby.iapi.types.DataValueFactory >> org.apache.derby.iapi.types.StringDataValue getClobDataValue(java.sql.Clob, org.apache.derby.iapi.types.StringDataValue) because java.lang.NoSuchMethodException: org.apache.derby.iapi.types.DataValueFactory.getClobDataValue(java.sql.Clob, org.apache.derby.iapi.types.StringDataValue): org.apache.derby.shared.common.sanity.AssertFailure'.

      I will attach test cases which demonstrate these problems.

        Attachments

        1. wclob.sql
          0.3 kB
          Richard N. Hillegas
        2. wblob.sql
          0.3 kB
          Richard N. Hillegas

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                rhillegas Richard N. Hillegas
              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: