question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[vertx-db2-client] SQL with 'fetch first 1 rows only' causes 'Found unknown codepoint: 0x215f / 8543'

See original GitHub issue

Queries using fetch first 1 rows only doesn’t seem to work. Query example:

select message from immutable order by id fetch first 1 rows only

Version

vertx-db2-client versions 3.9.5 and 4.0.2.

Context

Exception:

[2021-02-13 09:33:58] FINE io.vertx.db2client.impl.codec.DB2Decoder                <<< DECODE io.vertx.db2client.impl.codec.InitialHandshakeCommandCodec@6bf9ad5d (432 bytes)
[2021-02-13 09:33:58] FINE io.vertx.db2client.impl.codec.DB2Encoder                >>> ENCODE SimpleQueryCommandCodec@fe7e38d sql=select message from immutable order by id fetch first 1 rows only, section=null
[2021-02-13 09:33:58] FINE io.vertx.db2client.impl.codec.DB2Decoder                <<< DECODE SimpleQueryCommandCodec@fe7e38d sql=select message from immutable order by id fetch first 1 rows only, section=io.vertx.db2client.impl.drda.Section@677ec5e7{packageName=SYSSH200, sectionNumber=1, cursorName=SQL_CURSH200C} (472 bytes)
[2021-02-13 09:33:58] FINE io.vertx.db2client.impl.drda.Section release            Releasing section: io.vertx.db2client.impl.drda.Section@677ec5e7{packageName=SYSSH200, sectionNumber=1, cursorName=SQL_CURSH200C}
[2021-02-13 09:33:58] SEVERE io.vertx.db2client.impl.codec.DB2Decoder                FATAL: Error parsing buffer at index 258 / 0x102
For command SimpleQueryCommandCodec@fe7e38d sql=select message from immutable order by id fetch first 1 rows only, section=io.vertx.db2client.impl.drda.Section@677ec5e7{packageName=SYSSH200, sectionNumber=1, cursorName=SQL_CURSH200C}
         +-------------------------------------------------+
         |  0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f |
+--------+-------------------------------------------------+----------------+
|00000000| 00 d6 d0 43 00 01 00 d0 24 11 00 00 00 00 00 30 |...C....$......0|
|00000010| 30 30 30 30 53 51 4c 31 31 30 35 30 00 00 00 00 |0000SQL11050....|
|00000020| 00 00 00 00 00 01 00 00 00 07 00 00 00 21 ff ff |.............!..|
|00000030| ff 00 00 00 00 20 20 20 20 20 20 20 20 20 20 20 |.....           |
|00000040| 00 12 56 45 52 54 58 20 20 20 20 20 20 20 20 20 |..VERTX         |
|00000050| 20 20 20 20 00 00 00 00 ff 00 01 00 00 00 00 00 |    ............|
|00000060| 00 00 55 00 00 00 00 00 00 00 00 00 01 00 00 00 |..U.............|
|00000070| 00 00 00 08 00 00 00 00 00 00 c0 01 04 b8 00 00 |................|
|00000080| 00 00 07 4d 45 53 53 41 47 45 00 00 00 00 00 00 |...MESSAGE......|
|00000090| 00 00 00 00 ff 00 00 00 00 00 00 00 00 00 00 05 |................|
|000000a0| 56 45 52 54 58 00 09 49 4d 4d 55 54 41 42 4c 45 |VERTX..IMMUTABLE|
|000000b0| 00 00 00 09 49 4d 4d 55 54 41 42 4c 45 00 00 00 |....IMMUTABLE...|
|000000c0| 08 56 45 52 54 58 20 20 20 00 00 00 07 4d 45 53 |.VERTX   ....MES|
|000000d0| 53 41 47 45 00 00 00 34 d0 52 00 02 00 2e 22 05 |SAGE...4.R....".|
|000000e0| 00 06 11 49 00 00 00 06 21 02 24 17 00 05 21 1f |...I....!.$...!.|
|000000f0| f1 00 05 21 50 01 00 0c 21 5b 00 00 00 00 00 00 |...!P...![......|
|00000100| 00 00 00 08 21 5f 00 00 00 01 00 1f d0 53 00 02 |....!_.......S..|
|00000110| 00 19 24 1a 06 76 d0 3e 08 00 09 71 e0 54 00 01 |..$..v.>...q.T..|
|00000120| d0 00 01 06 71 f0 e0 00 00 00 30 d0 53 00 02 00 |....q.....0.S...|
|00000130| 2a 24 1b ff 00 00 22 66 6f 72 74 75 6e 65 3a 20 |*$...."fortune: |
|00000140| 4e 6f 20 73 75 63 68 20 66 69 6c 65 20 6f 72 20 |No such file or |
|00000150| 64 69 72 65 63 74 6f 72 79 00 26 d0 52 00 02 00 |directory.&.R...|
|00000160| 20 22 0b 00 06 11 49 00 04 00 16 21 10 e5 c5 d9 | "....I....!....|
|00000170| e3 e7 40 40 40 40 40 40 40 40 40 40 40 40 40 00 |..@@@@@@@@@@@@@.|
|00000180| 59 d0 03 00 02 00 53 24 08 00 64 00 00 00 30 32 |Y.....S$..d...02|
|00000190| 30 30 30 53 51 4c 52 49 30 31 46 00 01 00 04 80 |000SQLRI01F.....|
|000001a0| 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
|000001b0| 00 00 00 00 20 20 20 20 20 20 20 20 20 20 20 00 |....           .|
|000001c0| 12 56 45 52 54 58 20 20 20 20 20 20 20 20 20 20 |.VERTX          |
|000001d0| 20 20 20 00 00 00 00 ff                         |   .....        |
+--------+-------------------------------------------------+----------------+
java.lang.IllegalStateException: Found unknown codepoint: 0x215f / 8543
	at io.vertx.db2client.impl.drda.DRDAResponse.throwUnknownCodepoint(DRDAResponse.java:847)
	at io.vertx.db2client.impl.drda.DRDAQueryResponse.parseOPNQRYRM(DRDAQueryResponse.java:2224)
	at io.vertx.db2client.impl.drda.DRDAQueryResponse.parseBeginOpenQuery(DRDAQueryResponse.java:163)
	at io.vertx.db2client.impl.drda.DRDAQueryResponse.readBeginOpenQuery(DRDAQueryResponse.java:128)
	at io.vertx.db2client.impl.codec.SimpleQueryCommandCodec.decodeQuery(SimpleQueryCommandCodec.java:76)
	at io.vertx.db2client.impl.codec.QueryCommandBaseCodec.decodePayload(QueryCommandBaseCodec.java:69)
	at io.vertx.db2client.impl.codec.DB2Decoder.decodePayload(DB2Decoder.java:80)
	at io.vertx.db2client.impl.codec.DB2Decoder.decode(DB2Decoder.java:53)

Do you have a reproducer?

https://github.com/DavideD/vertx-sql-client/commit/e1d5ceb26780eb22d52f5f60db43c8ae19895013 Or, add this test to QueryVariationsTest:


  @Test
  public void testFetchFirst(TestContext ctx) {
    connect(ctx.asyncAssertSuccess(conn -> {
      conn.query("select message from immutable order by id fetch first 1 rows only").execute(
        ctx.asyncAssertSuccess(rowSet -> {
          ctx.assertEquals(1, rowSet.size());
          ctx.assertEquals(Arrays.asList("message"), rowSet.columnsNames());
          RowIterator<Row> rows = rowSet.iterator();
          ctx.assertTrue(rows.hasNext());
          Row row = rows.next();
          ctx.assertEquals("fortune: No such file or directory", row.getString(0));
          ctx.assertFalse(rows.hasNext());
          conn.close();
        }));
    }));
  }
``

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:13 (12 by maintainers)

github_iconTop GitHub Comments

1reaction
mswatoshcommented, May 27, 2021

I’ve got the recreate running in my local environment (thanks for providing it!).

Looks like we’re missing support for the Query Blocking Factor CodePoint (0x215F), I’ve got it added to the codepoints in CodePoint.java and I’m looking into how it will need to be handled in DRDAQueryResponse.

0reactions
vietjcommented, Jun 2, 2021

thanks @mswatosh this is the correct branch to use, you can back-port to branch 3.9 and we will release it in 3.9.8 scheduled soon

Read more comments on GitHub >

github_iconTop Results From Across the Web

Vertx DB2 client - GitHub
[DB2] Support for CLOB / BLOB data types vertx-sql-client#496 opened by aguibert module:db2. From Future tasks. Copy card link.
Read more >
SQL Server 'FETCH FIRST 1 ROWS ONLY' Invalid usage
I am trying to convert a Db2 query to SQL Server, I came across a construct I am not familiar with: FETCH FIRST...
Read more >
Strange behaviour of FETCH FIRST ? ROWS ONLY in DB2
The problem is this does not work and DB2 says. om.ibm.db2.jcc.b.SQLException: An unexpected token "?" was found. following "ay_field FETCH FIRST".
Read more >
Problem with using FETCH in select statement in Oracle 11g
HI Can any one help me, why i am getting the following error in Oracle ... ERROR I AM GETTING IS: FETCH FIRST...
Read more >
SQL TOP , LIMIT , FETCH FIRST or ROWNUM Clause
MySQL supports the LIMIT clause to select a limited number of records, while Oracle uses FETCH FIRST n ROWS ONLY and ROWNUM ....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found