?
Categories
Account

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

₹0.0
Login to Download
  • 📥 Instant PDF Download
  • ♾ Lifetime Access
  • 🛡 Secure & Original Content

What’s inside this PDF?

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

Options:

  1. executeQuery()
  2. runQuery()
  3. executeSQL()
  4. executeStatement()

Correct Answer: executeQuery()

Solution:

In JDBC, the method used to execute a SQL statement is \'executeQuery()\'.

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.
  • JDBC Execution Methods – Understanding the different methods in JDBC for executing SQL statements, such as executeQuery(), executeUpdate(), and execute().
Soulshift Feedback ×

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

Not likely Very likely
Home Practice Performance eBooks