1. Học hỏi
  2. /
  3. Khoa Học
  4. /
  5. Querying a PostgreSQL Database in Java

Connected

Bài tập

Prepared Statements

After discovering the SQL injection vulnerability, CityBook Libraries needs you to secure the book search feature. You'll switch from simple Statement objects to PreparedStatement to prevent injection attacks.

The HikariSetup class is already configured.

Hướng dẫn

100 XP
  • Use a placeholder for the title parameter.
  • Create a PreparedStatement from the connection.
  • Set the title parameter for the prepared statement.