我试图在插入 Connections 表时检索 connection_id 列。我有一个像这样在应用程序开始时生成的表,其中 column_id 是自动生成的。
CREATE TABLE connections (connection_ID INT not null primary key GENERATED ALWAYS AS IDENTITY(START WITH 1, INCREMENT BY 1),
connection_name VARCHAR(100) unique not null, user_name VARCHAR(100) not null, password VARCHAR (100) not null, server_url
VARCHAR(100) not null, port_number VARCHAR(10) not null),
我正在使用以下语句来检索 connection_ids 的 liat
PreparedStatement stmt = dbconn.prepareStatement(insertString, new String[] {"connection_id"});
但是即使我的 connection_id 是自动生成的,我也会收到以下异常,
java.sql.SQLException: Table 'CONNECTIONS' does not have an auto-generated column named 'connection_id'.