IntelliJ Save To Database

Опубликовано: 05 Октябрь 2024
на канале: Prof. Vanselow
920
4

void saveToDB() {
try {
System.out.println("Attempting INSERT");
String sql = "INSERT INTO Bike (Make, Handlebars, Frame, Tyres, SeatType, NumGears) "
"VALUES ('Huffy', 'Cruiser', 'Diamond', 'Fat', 'Comfort', 1);";
stmt.executeUpdate(sql);
System.out.println("INSERT Successful");
} catch (SQLException se) {
se.printStackTrace();
Alert a = new Alert(Alert.AlertType.ERROR);
a.show();
} catch (Exception e) {
e.printStackTrace();
}
}

https://www.w3schools.com/sql/sql_ins...
https://www.tutorialspoint.com/jdbc/j...