Answers for "jdbc insert example from input values"

0

jdbc insert example from input values

// 2. Create a statement
	String sql = "insert into employees "
			+ " (last_name, first_name)" + " values (?, ?)";
	myStmt = myConn.prepareStatement(sql);
	// set param values
	myStmt.setString(1, lastName);
	myStmt.setString(2, firstName);
	// 3. Execute SQL query
	myStmt.executeUpdate();
Posted by: Guest on February-21-2021
0

jdbc insert example from input values

// 0. read user input from command line: last name, first name and email
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();
Posted by: Guest on February-21-2021

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language