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

0

What SQL dialect are you using? Could you please share an example of generated DLL? What types of columns?

0

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:

create table DQM.DQMIMP_DFUE;

Column types in the table are bigint, timestamp, smallint, varchar(...) and blob(...).

0

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:

create table WELCOMMEN.TABLE_NAME
(
COLUMN_1 BIGINT,
COLUMN_2 TIMESTAMP(6),
COLUMN_3 SMALLINT,
COLUMN_4 VARCHAR(20),
COLUMN_5 BLOB(1048576)
);
0

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:

0

Could you please share a DLL of that table (right-click on the table name, select Go to DLL option)?

0

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.

CREATE SCHEMA DQM;
CREATE TABLE DQM.DQMIMP_DFUE
(
ID bigint PRIMARY KEY NOT NULL,
EINGANG timestamp,
VERARBEITUNG timestamp,
STATUS smallint,
STATUSTEXT varchar(100),
DATEINAME varchar(350),
DATENSENDERNUMMER varchar(9),
DATENEMPFANGSWERK varchar(10),
WARENEMPFANGSWERK varchar(10),
SENDUNGSSCHLUESSEL varchar(250),
EINGANGEDICS timestamp,
ANWENDUNGSSYSTEM varchar(4),
UEBERTRAGUNGSNUMMER varchar(5),
VDAZIP blob(2097152),
XMLZIP blob(2097152),
VDASIZE int DEFAULT 0 NOT NULL,
XMLSIZE int DEFAULT 0 NOT NULL,
DISP_SENDUNGSLADUNGSBEZUGSNUMMER varchar(35),
DISP_LIEFERSCHEINNUMMER varchar(35),
DISP_BORDERONUMMER varchar(25),
DQMSENDE timestamp,
DISP_ABLADESTELLE varchar(10),
DISP_LIEFERANTENNUMMER varchar(25)
);
0

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.

0

Please try to add -Ddb2.jcc.charsetDecoderEncoder=3 to VM options and refresh schemas to see if it helps.

0

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.

1

Thank you Daniil, your hint solved the problem!

That saves me from hunting down obscure data :-)

1

请先登录再写评论。