Question: For which value of name will this code result in a successful SQL injection attack? A. DELETE TABLE records; B. 'Olivia'; DELETE TABLE records C.
For which value of name will this code result in a successful SQL injection attack?

A. DELETE TABLE records;
B. 'Olivia'; DELETE TABLE records
C. 'Sophia; DELETE TABLE records
D. 'Elysia'; DELETE TABLE records
E. ?; DELETE TABLE records;
F. None of the above.
public Integer getScore (String connectionStr, String name) throws SQLException { } var query = "SELECT score FROM records WHERE name = ?"; var con Driver Manager.getConnection (connectionStr); try (con; var stmt = con.prepareStatement (query)) { stmt.setString(1, name); try (var rs = stmt.executeQuery()) { if(rs.next()) return rs.getInt("score"); } } return null;
Step by Step Solution
3.34 Rating (157 Votes )
There are 3 Steps involved in it
The code snippet provided is using a PreparedStatement for executing the SQL query which is designed ... View full answer
Get step-by-step solutions from verified subject matter experts
