私のプログラムがなぜテーブルを作成していないのか分かりませんが、作成した後にこのようなコードでテーブルを埋める方法についてのアイデアが必要ですか?私はこのデータベースにも2つのテーブルを追加する必要があります。コードからJAVAデータベースを作成する。ステートメントは実行してテーブルを作成しませんか?
これは私が取得していますエラーです:
java.sql.SQLSyntaxErrorException: Table/View 'PIZZASIZE' does not exist.
Caused by: ERROR 42X05: Table/View 'PIZZASIZE' does not exist.
Caused by: java.lang.RuntimeException: Exception in Application start method
Caused by: javafx.fxml.LoadException: file:/C:/Users/Allie/Documents/NetBeansProjects/Pizzeria_AllieBeckman/dist/run1674141987/Pizzeria_AllieBeckman.jar!/pizzeria_alliebeckman/FXMLDocument.fxml
これは、テーブルを作成することになっていますコードです:
// connect to the derby URL using the given username and password
connect = DriverManager.getConnection("jdbc:derby://localhost:1527/pizzeria;create=true", connectProps);
// current url for pre created database "jdbc:derby://localhost:1527/pizza"
// if connection is successful print that it succeeded.
System.out.println("database created");
stmt = connect.createStatement();
String sqlCreate = "CREATE TABLE PIZZASIZE "
+ "(id int NOT NULL, "
+ "size char(20) NOT NULL, "
+ "PRIMARY KEY (id))";
stmt.execute(sqlCreate);
試しstmt.executeUpdate(sqlCreate)と 'stmt.executeUpdate(sqlCreate)' –
同じエラー:( –
'のSystem.out.println( "作成したデータベース");'これが実行された印刷を行う –