What method is commonly used to execute SQL queries in Java?
- execute()
- executeQuery()
- executeStatement()
- executeUpdate()
In Java, the executeQuery() method is commonly used to execute SQL queries using JDBC. This method is specifically designed for executing SELECT queries and returns a ResultSet containing the query results. The other options (executeStatement(), executeUpdate(), and execute()) are not typically used for executing queries or have different purposes.
Loading...
Related Quiz
- What will happen if the DriverManager is unable to connect to the database using the provided URL?
- What is the role of the ObjectOutputStream class in serialization?
- Consider a case where you have to model a "Book" in a library system. What properties and methods would you define in the Book class and why?
- ________ allows you to traverse the collection, access the element, and insert
- If a class has multiple constructors, it can be said to have constructor ________.