The difference between excute,excuteupdate,excutequery in Java

Source: Internet
Author: User
executeQuery (String sql) executes the SELECT statement, which returns a Recordset (resultset) after the query.

executeupdate (String sql) executes the Update,insert,delete statement, which returns the number of record bars (int) that are affected by the statement execution. For DDL statements that do not manipulate rows such as CREATE table or DROP table, the return value of executeupdate is always zero.

Execute (String sql) executes any SQL statement, which is one of the first two. The return value is a representation of the first result. Returns True when the first execution result is a query statement, which can be obtained by the Getresultset method, or False when the first execution result is an UPDATE statement or DDL statement, and the number of records updated can be obtained through the Getupdatecount method.

The difference between excute,excuteupdate,excutequery in Java

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.