IntelliJ Idea: Generate DDL for table is missing columns
已回答
When I generate the DDL for an existing table in a database connection via
right-click table > SQL Scripts... > Generate DDL to Query Console...
it only generates "create table <name>;" without any columns. But I can see the table and its data successfully when double-clicking the table.
Details:
- IntelliJ IDEA 2021.2.4 (Ultimate Edition), Build #IU-212.5712.43, built on December 21, 2021
请先登录再写评论。
What SQL dialect are you using? Could you please share an example of generated DLL? What types of columns?
I'm using DB2 11.1.33, JDBC driver 4.25.23 (JDBC4.1).
This is what the table looks like:

...and this is the generated DDL:
Column types in the table are bigint, timestamp, smallint, varchar(...) and blob(...).
Could you please update IntelliJ IDEA to the latest available version to see if it helps?
I've tried to reproduce it with DB2 and I'm getting the expected result:
I updated my IntelliJ to the latest release. It is now:
IntelliJ IDEA 2022.1.1 (Ultimate Edition)
Build #IU-221.5591.52, built on May 10, 2022
Apparently my problem only affects one database schema, where I can reproduce my problem and see no column details in the database tree view (however, I can double-click the table an succesfully browse its contents):
In the same DB2 databse, but a different schema, table DDL is generated perfectly well and tables are shown like this:

Could you please share a DLL of that table (right-click on the table name, select Go to DLL option)?
I guess you meant "DDL" ;-)
Here's the DDL for the table I'm reproducing the problem with (generated via SQuirreL SQL client).
*However*, note that the problem exists for all tables in the same schema.
I just set up a fresh workspace and re-connected to my database. While it initially retrieved all the structural data it showed a popup with this text:
"Error encountered when performing Introspect schema DQM: [jcc][t4][1065][12306][4.25.23] Bedingung java.io.CharConversionException abgefangen. Details finden Sie im angehängten Element der Throwable-Klasse. ERRORCODE=-4220, SQLSTATE=null. [jcc][t4][1065][12306][4.25.23] Bedingung java.io.CharConversionException abgefangen. Details finden Sie im angehängten Element der Throwable-Klasse. ERRORCODE=-4220, SQLSTATE=null."
I reached the same state I was in before: One schema is "broken" (i.e. table columns not shown in db browser), other schemas show tables with columns all right. Very strange.
Please try to add -Ddb2.jcc.charsetDecoderEncoder=3 to VM options and refresh schemas to see if it helps.
I think IBM has described the problem here: https://www.ibm.com/support/pages/sqlexception-message-caught-javaiocharconversionexception-and-errorcode-4220
Indeed the database is running with UTF-8, and according to IBM's description there seems to be some non-UTF-8 data.
I'll try to locate and repair that data.
Thank you Daniil, your hint solved the problem!
That saves me from hunting down obscure data :-)