Index: java/engine/org/apache/derby/impl/jdbc/EmbedConnection.java =================================================================== --- java/engine/org/apache/derby/impl/jdbc/EmbedConnection.java (revision 617186) +++ java/engine/org/apache/derby/impl/jdbc/EmbedConnection.java (working copy) @@ -2554,11 +2554,19 @@ } /** - * Return the current locator value + * Return the current locator value/ + * 0x8004 is not a valid value as it is used to indicate the BLOB + * is being sent by value, so we skip that valu (DERBY-3243) + * * @return an integer that represents the most recent locator value. */ private int getIncLOBKey() { - return ++rootConnection.lobHMKey; + int newKey = ++rootConnection.lobHMKey; + // Skip 0x8000, 0x8002, 0x8004, 0x8006, for DERBY-3243 + if (newKey == 0x8000 || newKey == 0x8002 || newKey == 0x8004 || + newKey == 0x8006 || newKey == 0x8008) + newKey = ++rootConnection.lobHMKey; + return newKey; } /** Index: java/client/org/apache/derby/client/net/NetCursor.java =================================================================== --- java/client/org/apache/derby/client/net/NetCursor.java (revision 617186) +++ java/client/org/apache/derby/client/net/NetCursor.java (working copy) @@ -1061,9 +1061,12 @@ private int locator(int column) { int locator = get_INTEGER(column); - // If Lob value was sent instead of locator, highest bit will be set + // If Lob value was sent instead of locator, the value will be + // 0x8000, 0x8002, 0x8004, 0x8006, 0x8008. This is not a locator + // but the blob has been sent by value. // Zero is not a valid locator, it indicates a zero length value - if (((locator & 0x8000) == 0x8000) || (locator == 0)) { + if ((locator == 0x8000) || (locator == 0x8002) || (locator == 0x8004) || + (locator == 0x8006) || (locator == 0x8008) ||(locator == 0)) { return Lob.INVALID_LOCATOR; } else { return locator;