jdbc insert example from input values
Example 1: jdbc insert example from input values
String sql = "insert into employees "
+ " (last_name, first_name)" + " values (?, ?)";
myStmt = myConn.prepareStatement(sql);
myStmt.setString(1, lastName);
myStmt.setString(2, firstName);
myStmt.executeUpdate();
Example 2: jdbc insert example from input values
Scanner scanner = new Scanner(System.in);
System.out.print("Enter your last name: ");
String lastName = scanner.nextLine();
System.out.print("Enter your first name: ");
String firstName = scanner.nextLine();