Home  >  Article  >  _______ objects are used to execute static SQL statements and obtain their results.

_______ objects are used to execute static SQL statements and obtain their results.

WBOY
WBOYforward
2024-02-22 13:00:23818browse

php editor Strawberry brings you an article about Java Q&A. In Java, _________ objects are used to execute static SQL statements and obtain the results they produce. This article will answer this question for you and help you better understand the relevant knowledge points in Java programming. Let’s explore this topic together and improve your skills in the field of Java!

Question content

_______ object is used to execute static SQL statements and obtain their results.

  • a) Statement
  • b) Database
  • c) Result set
  • d) sql

According to me the correct answers are "statement" and "result set", but when I argued to sir that both of these are correct answers, he denied this and said that the only correct answer is "statement". Can someone give a proper explanation why they are both correct, the answer should be SQL since it has both Statement and Resultset.

Solution

ResultSet Does not execute the SQL statement. there has never been.

Statement.execute() Called to execute the SQL statement and return ResultSet. therefore:

  • It executes the SQL statement, and
  • It gets the result in the form of ResultSet.

So if you need to choose one of these four options:

  • a) Statement is the correct answer; see above.
  • c) ResultSet is not the correct answer; see above.
  • b) and d) are not correct answers because there is no such thing as "sql object" or "db object" in the JDBC model.

And Statement ResultSet is not an option. If this were an option, it would also (arguably) be correct.

In short, "Sir" is correct and you are wrong. Just accept it.

The above is the detailed content of _______ objects are used to execute static SQL statements and obtain their results.. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:stackoverflow.com. If there is any infringement, please contact admin@php.cn delete