« Colonnes manquantes en relation » lors de la création tableau

Claude De-Tchambila :

J'ai essayé de créer trois tables (clients, véhicules et locations), la troisième table (location) a des clés étrangères faisant référence aux deux clés primaires des deux premières tables (clients et de la location). Lors de la création de cette troisième table , je reçois une erreur colonnes manquantes en relation (rel = CLIENTS [[]] -> LOCATION [[]])

Voici mes codes

     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");
     }

et voici l'erreur entrez la description d'image ici

Votre aide sera très appréciée, je l'ai regardé autour, mais rien trouvé qui aide.

Gord Thompson:

Dans Access, un champ NuméroAuto (DDL: AUTOINCREMENTou COUNTER) est un « Entier long ».

Dans UCanAccess DDL, INTEGERcrée un champ « entier » (16 bits) et LONGcrée un champ « Entier long » (32 bits).

Vous devez déclarer vos colonnes clés étrangères LONG, non INTEGER.

Je suppose que tu aimes

Origine http://43.154.161.224:23101/article/api/json?id=313652&siteId=1
conseillé
Classement