In JDBC, which method is used to execute a SQL statement?

Practice Questions

Q1
In JDBC, which method is used to execute a SQL statement?
  1. executeQuery()
  2. runQuery()
  3. executeSQL()
  4. executeStatement()

Questions & Step-by-Step Solutions

In JDBC, which method is used to execute a SQL statement?
Correct Answer: executeQuery()
  • Step 1: Understand that JDBC stands for Java Database Connectivity, which is a Java API for connecting to databases.
  • Step 2: Know that to interact with a database, you need to execute SQL statements.
  • Step 3: Identify that there are different methods in JDBC for executing SQL statements, such as 'executeQuery()', 'executeUpdate()', and 'execute()'.
  • Step 4: Recognize that 'executeQuery()' is specifically used for executing SQL statements that return data, like SELECT queries.
  • Step 5: Conclude that if you want to execute a SQL statement in JDBC that retrieves data, you should use the 'executeQuery()' method.
No concepts available.
Soulshift Feedback ×

On a scale of 0–10, how likely are you to recommend The Soulshift Academy?

Not likely Very likely