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.

DB2 some binary fields not properly formatted since 6.3.5

See original GitHub issue

Since version 6.3.5 (including 7.x) columns that are defined as datatype CHAR(13) FOR BIT DATA no longer get formatted according to the Binary data formatter setting (global or connection specific). All 6.3.x versions prior to 6.3.5 work as expected.

System information:

  • Linux / Mac
  • DBeaver v6.3.5 or greater
  • DB2 LUW driver with default settings

The following examples are with the binary data formatter set to Hex formatting. image

Both columns displayed the same values prior to 6.3.5. But that version or higher show garbled text instead of hex formatting the binary value.

SELECT mycolumn AS the_column, hex(mycolumn) AS the_column_cast_as_hex FROM mytable LIMIT 5;

Result in version 6.3.4 image

Result in 6.3.5 image

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
gsaulmoncommented, Apr 18, 2020

Full reproduction steps.

Tested on 7.0.2

Optional: setup a db2 server

This will create a db2 server that you can connect to at localhost with a database of testdb, username of db2inst1 and password of test

docker run -it --rm --name db2 --cap-add IPC_LOCK --cap-add IPC_OWNER -p 50000:50000 -e LICENSE=accept -e DB2INST1_PASSWORD=test -e DBNAME=testdb ibmcom/db2

Create a DB2 LUW connection to the db2 instance

  • Edit the connection and set Result Sets -> Editors -> Binary data formatter to Hex

Create some data

CREATE SCHEMA "MYTEST";
CREATE TABLE "MYTEST"."MYTABLE" ( "MYFIELD" CHAR(13) FOR BIT DATA NOT NULL );
INSERT INTO mytest.MYTABLE  (MYFIELD) VALUES (generate_unique()), (generate_unique());

Query it

SELECT myfield, hex(myfield) AS myfield_as_hex FROM mytest.mytable;

That query will return with both columns matching and properly formatted as hex; only until you disconnect the first time.

Once you’ve disconnected/reconnected or closed/reopened dbeaver the formatting is no longer applied to the results of that query.

It should also be noted that creating temporary binary data in a query is always formatted correctly. Results from SELECT generate_unique() FROM SYSIBM.sysdummy1; are formatted correctly

0reactions
kseniiaguzeevacommented, May 6, 2020

verified

Read more comments on GitHub >

github_iconTop Results From Across the Web

Supported numeric formats - IBM
When you map a zoned decimal field to any numeric column in CICS VT, you specify the field type C . For every...
Read more >
Security Bulletin: Vulnerability in OpenSSL affects IBM® DB2® LUW ...
Summary An OpenSSL denial of service vulnerability disclosed by the OpenSSL Project affects GSKit and IBM Tivoli Flash Copy Manager. IBM DB2 LUW...
Read more >
Functions for Use in SELECT and WHERE Clauses - O'Reilly
Hexadecimal values are treated as binary strings if not compared to a number. If one of the arguments is a TIMESTAMP or DATETIME...
Read more >
SQL*Plus® - User's Guide and Reference - Oracle Help Center
It is not developed or intended for use in any inherently dangerous applications, ... Substitution Variable Namespace, Types, Formats and Limits.
Read more >
MySQL Workbench
formats is allowed as long as the actual content is not altered or edited in any way. You shall not publish or distribute...
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