#42114·dbeaver

IBM Db2 LUW 9.1: table DDL generation fails

Author: mark-lobanovCreated Sep 14, 2026Updated Sep 17, 2026
Labelsx:db2can't reproducexf:sqlwait for reviewxqa:need-testing

Description

DB2/NT v9.1 (SQL09010): table DDL generation fails; CLP tests isolate -x and -xd as rejected DB2LK_GENERATE_DDL arguments

Summary

When table DDL is requested in DBeaver 26.2.0, the reporter observes this error in the DBeaver UI:

Error running DDL generation
SQL Error [38553]: Routine "SYSPROC.DB2LK_GENERATE_DDL"
(specific name "DB2LK_GENERATE_DDL") has returned an error SQLSTATE
with diagnostic text "Invalid input".

The attached DBeaver debug logs do not contain that UI error text. They do show the command string DBeaver passes to DB2LK_GENERATE_DDL and show that the same option pattern is used with both tested JDBC drivers:

-noview -e -x -xd -td <line break> -t <schema>.<table>

Direct DB2 CLP tests attached to this report isolate the relevant options on the same tested database:

  • tested argument sets without -x / -xd succeed;
  • -x alone returns SQLSTATE=38553 / Invalid input;
  • -xd alone returns SQLSTATE=38553 / Invalid input;
  • adding -x or -xd to otherwise successful tested argument sets returns SQLSTATE=38553;
  • a separate malformed argument sequence also returns SQLSTATE=38553, so that SQLSTATE alone is not specific to -x / -xd.

These observations describe the attached test results for this database only. They do not establish a DB2 version or fix-pack boundary at which DB2LK_GENERATE_DDL behavior changes.

Environment facts from the attached DBeaver logs

The following values are quoted from both attached DBeaver debug logs:

  • DBeaver: 26.2.0.202608301738
  • DBeaver log OS string: Windows 10 10.0 (amd64)
  • Java: 25.0.3 by Microsoft, 64-bit
  • Database product name: DB2/NT
  • Database product version: SQL09010
  • DBeaver also logs the connected database as version v9.1

Tested JDBC drivers, as reported by the attached logs:

  • IBM DB2 JDBC Universal Driver Architecture, version 3.8.88
  • IBM Data Server Driver for JDBC and SQLJ, version 4.34.30

No Windows marketing edition is inferred from the DBeaver OS string. No server fix-pack level is inferred from SQL09010 or from any client installation information.

DBeaver 26.2.0 source-code evidence

The DBeaver 26.2.0 source code itself shows how the command is built.

In plugins/org.jkiss.dbeaver.ext.db2/src/org/jkiss/dbeaver/ext/db2/DB2Utils.java, generateDDLforTable(...) contains:

String command = String.format(
    (includeViews ? "" : "-noview ") + "-e -x -xd -td %s -t %s",
    statementDelimiter,
    db2Table.getFullyQualifiedName(DBPEvaluationContext.DDL));

The same source file comments that DBeaver uses the SYSPROC.DB2LK_GENERATE_DDL stored procedure as an undocumented mechanism.

Source at tag 26.2.0:

https://github.com/dbeaver/dbeaver/blob/26.2.0/plugins/org.jkiss.dbeaver.ext.db2/src/org/jkiss/dbeaver/ext/db2/DB2Utils.java

In plugins/org.jkiss.dbeaver.ext.db2/src/org/jkiss/dbeaver/ext/db2/model/DB2Table.java, DBeaver defines:

private static final String LINE_SEPARATOR = GeneralUtils.getDefaultLineSeparator();

and passes that value to generateDDLforTable(...):

return DB2Utils.generateDDLforTable(monitor, LINE_SEPARATOR, getDataSource(), this, includeViews);

Source at tag 26.2.0:

https://github.com/dbeaver/dbeaver/blob/26.2.0/plugins/org.jkiss.dbeaver.ext.db2/src/org/jkiss/dbeaver/ext/db2/model/DB2Table.java

This source-code evidence is consistent with the attached debug logs: the logged command contains -x -xd, and the value logged after -td contains a line break.

DBeaver debug-log evidence

JCC 3.8.88

dbeaver-logs/jcc-3.8.88/dbeaver-debug.log records:

DBeaver 26.2.0.202608301738 is starting
OS: Windows 10 10.0 (amd64)
Java version: 25.0.3 by Microsoft (64bit)

It records the connected database and driver as:

DATABASE1 is version v9.1
...
databaseProductName='DB2/NT'
databaseProductVersion='SQL09010'
driverName='IBM DB2 JDBC Universal Driver Architecture'
driverVersion='3.8.88'

For DDL generation it records:

Generate DDL for MYSCHEMA1.FDUBL2
Calling DB2LK_GENERATE_DDL with command : -noview -e -x -xd -td 
 -t MYSCHEMA1.FDUBL2

JCC 4.34.30

dbeaver-logs/jcc-4.34.30/dbeaver-debug.log records the same DBeaver version, OS string, Java version, database product and database version, with:

driverName='IBM Data Server Driver for JDBC and SQLJ'
driverVersion='4.34.30'

For DDL generation it records:

Generate DDL for MYSCHEMA.FDUBL2
Calling DB2LK_GENERATE_DDL with command : -noview -e -x -xd -td 
 -t MYSCHEMA.FDUBL2

The schema names in the two captures are different; they are reproduced above exactly as logged.

The debug logs do not themselves contain the SQLSTATE=38553 result of the DDL call. That error was observed by the reporter in the DBeaver UI. The attached CLP tests independently demonstrate the server response to isolated argument sets.

Direct DB2 CLP tests

The test cases below are summaries of the attached raw clp-tests/*.cmd and clp-tests/*.log files. The raw files are authoritative and are included without content edits.

1. Baseline succeeds

Command in 1.cmd:

db2 CALL "SYSPROC.DB2LK_GENERATE_DDL('-e -t MYSCHEMA.FDUBL2', ?)"

Observed in 1.log:

  • OP_TOKEN value: 18
  • localized CLP return-status value: 0

2. -td ; form succeeds

Command in 1.cmd:

db2 CALL "SYSPROC.DB2LK_GENERATE_DDL('-e -td ; -t MYSCHEMA.FDUBL2', ?)"

Observed in 1.log:

  • OP_TOKEN value: 19
  • localized CLP return-status value: 0

3. Adding -x fails

Command in 1.cmd:

db2 CALL "SYSPROC.DB2LK_GENERATE_DDL('-e -x -td ; -t MYSCHEMA.FDUBL2', ?)"

Observed in 1.log:

SQL0443N ... "Invalid input". SQLSTATE=38553

4. -x alone fails

Command in 5.cmd:

db2 CALL "SYSPROC.DB2LK_GENERATE_DDL('-x -t MYSCHEMA.FDUBL2', ?)"

Observed in 5.log:

SQL0443N ... "Invalid input". SQLSTATE=38553

5. -xd alone fails

Command in 5.cmd:

db2 CALL "SYSPROC.DB2LK_GENERATE_DDL('-xd -t MYSCHEMA.FDUBL2', ?)"

Observed in 5.log:

SQL0443N ... "Invalid input". SQLSTATE=38553

6. Adding -xd to the tested successful -e -td ; -t ... form fails

Command appears in both 2.cmd and 5.cmd:

db2 CALL "SYSPROC.DB2LK_GENERATE_DDL('-e -xd -td ; -t MYSCHEMA.FDUBL2', ?)"

Both corresponding logs report:

SQL0443N ... "Invalid input". SQLSTATE=38553

7. -noview is accepted in the tested form without -x / -xd

Command appears in 2.cmd and 6.cmd:

db2 CALL "SYSPROC.DB2LK_GENERATE_DDL('-noview -e -td ; -t MYSCHEMA.FDUBL2', ?)"

Observed results:

  • 2.log: OP_TOKEN value 20, localized CLP return-status value 0
  • 6.log: OP_TOKEN value 21, localized CLP return-status value 0

8. A value built with SYSFUN.CHR(13) || SYSFUN.CHR(10) in the -td position is accepted in the tested form without -x / -xd

7.cmd executes:

db2 "CALL SYSPROC.DB2LK_GENERATE_DDL('-noview -e -td ' || SYSFUN.CHR(13) || SYSFUN.CHR(10) || ' -t MYSCHEMA.FDUBL2', ?)"

Observed in 7.log:

  • OP_TOKEN value: 22
  • localized CLP return-status value: 0

This test establishes only that this SQL expression produces an argument accepted by the procedure in this tested form. The generated DDL was not inspected in this test to determine how the procedure semantically interprets those characters as a -td value.

9. A separate malformed argument sequence also returns 38553

Command in 3.cmd:

db2 CALL "SYSPROC.DB2LK_GENERATE_DDL('-noview -e -td -t MYSCHEMA.FDUBL2', ?)"

Observed in 3.log:

SQL0443N ... "Invalid input". SQLSTATE=38553

This control shows that SQLSTATE=38553 is not specific to -x or -xd. No assumption is made here about how the undocumented procedure tokenizes or interprets -td -t internally.

Evidence-based conclusion

For this connected database, the attached evidence establishes all of the following:

  1. DBeaver 26.2.0 source code unconditionally includes -x -xd in the DB2LK_GENERATE_DDL command built by generateDDLforTable(...).
  2. Both attached DBeaver debug logs show -x -xd in the command logged for table DDL generation.
  3. In direct CLP tests against the tested database, -x alone returns SQLSTATE=38553.
  4. In direct CLP tests against the tested database, -xd alone returns SQLSTATE=38553.
  5. Tested argument sets without -x / -xd succeed when using the other argument forms shown above.
  6. Switching between the two tested JDBC drivers does not change the DBeaver DDL option pattern shown in the debug logs.
  7. The CLP tests reproduce SQLSTATE=38553 without DBeaver or JDBC being involved in the call path used for those CLP tests.

No claim is made about other DB2 versions, other DB2 9.1 fix-pack levels, or the exact release/fix-pack at which DB2LK_GENERATE_DDL may accept these options.

Expected behavior

DBeaver should be able to generate table DDL for this connected DB2 v9.1 database without passing an argument set that the server-side DB2LK_GENERATE_DDL procedure rejects.

Requested investigation

Please investigate whether DBeaver should conditionally omit or otherwise handle -x and -xd when DB2LK_GENERATE_DDL on the connected database does not accept those options.

The evidence in this report does not establish a DB2 version/fix-pack cutoff, so no version boundary is proposed.

The report also does not propose retrying solely on SQLSTATE=38553, because 3.cmd / 3.log show the same SQLSTATE for a different malformed argument sequence.

A tested form that succeeds on this database is:

-noview -e -td ; -t <schema>.<table>

The separate 7.cmd test also succeeds when the value after -td is constructed using SYSFUN.CHR(13) || SYSFUN.CHR(10), but this report does not claim how that value is represented in generated DDL because the generated DDL was not inspected for that test.

Scope and limitations

  • The reporter-observed DBeaver UI error is not present in the attached DBeaver debug logs; the debug logs document the command DBeaver constructs.
  • The CLP tests isolate -x and -xd individually and in several combinations.
  • The attached CLP tests do not replay the exact full DBeaver command with both -x -xd and SYSFUN.CHR(13) || SYSFUN.CHR(10) in the same call. This is not claimed as tested.
  • The attached files do not establish a server fix-pack level.
  • The full DBeaver debug logs contain additional messages/errors concerning metadata/statistics and, with JCC 3.8.88, setClientInfo. Those messages are not analyzed as part of this DDL-generation report.

DBeaver documentation context

DBeaver's current IBM Db2 driver documentation states that the regular Db2 for LUW driver is used for DB2 versions newer than 8.x:

https://github.com/dbeaver/dbeaver/wiki/Database-driver-IBM-Db2

This report does not infer any IBM support lifecycle status from that DBeaver documentation statement.

Attached evidence

Raw CLP tests

  • clp-tests/1.cmd / clp-tests/1.log
  • clp-tests/2.cmd / clp-tests/2.log
  • clp-tests/3.cmd / clp-tests/3.log
  • clp-tests/5.cmd / clp-tests/5.log
  • clp-tests/6.cmd / clp-tests/6.log
  • clp-tests/7.cmd / clp-tests/7.log

Raw DBeaver debug logs

  • dbeaver-logs/jcc-3.8.88/dbeaver-debug.log
  • dbeaver-logs/jcc-4.34.30/dbeaver-debug.log

Password for archive: 1 dbeaver-db2-9.1-ddl-bug2.zip

DBeaver Version

Community edition 26.2.0

Operating System

Windows 10 (client), Windows 2016 (server)

Database and driver

Database: DB2 9.1 LUW Express-C for Windows Drivers: JDBC version 3.8.88, 4.34.30

Steps to reproduce

See archive

Additional context

No response