"Missing columns in relationship" 创建时 table

"Missing columns in relationship" when creating table

我尝试创建三个 tables(CUSTOMERS、VEHICLES 和 RENTALS),第三个 table (RENTALS) 有引用前两个 [= 的两个主键的外键25=]s(客户和租金)。创建第三个 table 时,我收到错误消息 Missing columns in relationship(Rel=CUSTOMERS[[]] -> RENTALS[[]])

这是我的代码

     private void createTables() throws SQLException {
        Statement statement = conn.createStatement();
        statement.executeUpdate("CREATE TABLE CUSTOMERS(custNumber AUTOINCREMENT PRIMARY KEY, " +
            "firstName VARCHAR(155) NOT NULL, surname VARCHAR(155) NOT NULL, idNum INTEGER NOT NULL, phoneNum INTEGER NOT NULL, canRent BIT NOT NULL)");
        statement.executeUpdate("CREATE TABLE VEHICLES(vehNumber AUTOINCREMENT PRIMARY KEY, make VARCHAR(155) NOT NULL, " +
            "category VARCHAR(155) NOT NULL, rentalPrice FLOAT NOT NULL, availableForRent BIT NOT NULL)");
        statement.executeUpdate("CREATE TABLE RENTALS(rentalNumber AUTOINCREMENT PRIMARY KEY, dateRental VARCHAR(155) NOT NULL, dateReturned VARCHAR(155) NOT NULL, " +
            "pricePerDay FLOAT NOT NULL, totalRental FLOAT NOT NULL, custNumber INTEGER FOREIGN KEY REFERENCES CUSTOMERS(custNumber), " +
            "vehNumber INTEGER FOREIGN KEY REFERENCES VEHICLES(vehNumber))");

        System.out.println("Database populated");
     }

这是错误

非常感谢您的帮助,我环顾四周但没有找到任何帮助。

在 Access 中,自动编号字段(DDL:AUTOINCREMENTCOUNTER)是 "Long Integer"。

在 UCanAccess DDL 中,INTEGER 创建一个 "Integer"(16 位)字段,LONG 创建一个 "Long Integer"(32 位)字段。

您需要将外键列声明为 LONG,而不是 INTEGER