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.

It's right time to invest in Cryptocurrencies Dogecoin! Earn free bitcoins up to $250 now by signing up.

Earn bitcoins upto $250 (free), invest in other Cryptocurrencies when you signup with blockfi. Use the referral link: Signup now and earn!

Using BlockFi, don't just buy crypto - start earning on it. Open an interest account with up to 8.6% APY, trade currencies, or borrow money without selling your assets.


Join CoinBase! We'll both receive $10 in free Bitcoin when they buy or sell their first $100 on Coinbase! Available in India also. Use the referral Join coinbase!


Invest now!!! Get Free equity stock (US, UK only)!

Use Robinhood app to invest in stocks. It is safe and secure. Use the Referral link to claim your free stock when you sign up!.

The Robinhood app makes it easy to trade stocks, crypto and more.


Webull! Receive free stock by signing up using the link: Webull signup.

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