Which method is used to execute SQL queries in JDBC?
- executeQuery()
- executeSQL()
- executeStatement()
- executeUpdate()
The executeQuery() method in JDBC is used to execute SQL queries that return a ResultSet, typically used for SELECT statements. The executeUpdate() method is used for executing SQL queries that modify the database, such as INSERT, UPDATE, or DELETE statements. The other options mentioned are not valid JDBC methods.
Loading...
Related Quiz
- When an array element, such as arr[2][3], is accessed, Java uses ________ to locate it in memory.
- Imagine that you are building a Java application to download files from an FTP server. How would you establish a connection and ensure the secure transmission of files from the server to your application?
- What is the purpose of the start() method in a JavaFX application?
- Which of the following methods is used to read data from an InputStream object connected to a socket?
- Which block among try, catch, and finally is optional in exception handling?