Prev Next

Java / JDBC

Difference between execute, executeQuery and executeUpdate in JDBC.

execute method can be used with any type of SQL statements and it returns a boolean. A true indicates that the execute method returned a result set object which can be retrieved using getResultSet method. false indicates that the query returned an int value or void. execute method can run both select and insert/update statements.

executeQuery method execute statements that returns a result set by fetching some data from the database. It executes only select statements.

executeUpdate method execute sql statements that insert/update/delete data at the database. This method return int value representing number of records affected; Returns 0 if the query returns nothing. The method accepts only non-select statements.

❤Cash Back At Stores you Love !!!❤

Earn your $10 reward when you make your first purchase through Ebates by signing up with clicking below button.

Ebates Coupons and Cash Back

More Related questions...

What is JDBC? Differences Between JDBC and ODBC. What is JDBC driver? Why thin driver is preferred for JDBC? Explain JDBC-ODBC bridge driver. Explain Native-API driver or Type 2 driver. Explain network protocol driver in JDBC. Which is the pure Java driver among the 4 types of JDBC Driver? How does JDBC achieve loose coupling between Java program and JDBC drivers? What are the steps involved in creating a JDBC connection? What is a Driver in JDBC? What is the role of DriverManager in JDBC? How to get the database details in a Java program? Explain JDBC statement. Difference between execute, executeQuery and executeUpdate in JDBC. Explain JDBC PreparedStatement. Why JDBC PreparedStatement is preferred? How do I set NULL as an input value for JDBC PreparedStatement? Advantages of PreparedStatement over Statement in JDBC. What are the steps to connect to the database in JDBC? What are the JDBC API? What are the types of JDBC statements? Which JDBC interface is responsible for managing transactions? How many layers are there in JDBC architecture? What are the design patterns involved in JDBC architecture? Is the connection pool object thread safe? How do you execute stored procedures and functions using JDBC? What is JDBC ResultSet? Different types of ResultSet in JDBC. What is row prefetching in JDBC? Difference between TYPE_SCROLL_INSENSITIVE and TYPE_SCROLL_SENSITIVE ResultSet. How to determine your data store or the JDBC driver supports different ResultSet types and concurrency? What is the return type of Class.forName method in Java? Does Oracle JDBC drivers support Java multithreading? How do you create your own transactions in JDBC? List few good practices in JDBC. What are the isolation levels defined by JDBC? Explain the role of JDBC Connection interface. Explain the role of JDBC ResultSet interface. How can we store images in the database using JDBC? Explain JDBC batch processing and its benefits. What does JDBC setMaxRows method do? What does JDBC setFetchSize method do? What are the locking systems in JDBC? Does the JDBC-ODBC Bridge support many concurrent open statements per connection? Difference between RowSet and ResultSet in JDBC. Difference between connected and disconnected RowSet in JDBC. Types of RowSet in JDBC. Explain JdbcRowSet in JDBC. What is SQLWarning In JDBC? When does JDBC No suitable driver error occurs? Explain steps involved in writing a Java program using JDBC. Which data type do you prefer: byte array or a java.sql.Blob in JDBC?
Show more question and Answers...

JNDI

Comments & Discussions