Statement Object Execution SQL statement

Source: Internet
Author: User

Statement Object Execution SQL statement about statement. It is an important step in Java performing Database operations, and can execute a few simple SQL statements to complete the operation of the database. It has two sub-interfaces, namely PreparedStatement and CallableStatement. The statement is used to execute a static SQL statement and return the object to which it produces results. By default, only one ResultSet object can be opened per statement object at the same time. Therefore, if you read a ResultSet object, and read another intersection, then two objects must be generated by different statement objects. Statement has many methods for database operations, including closing, executing queries, executing changes, and so on. Different methods will have different overrides, passing in different parameters and getting different results. As we write sqlhelper, there are different methods of execution, and queries have execute SQL statements and execute stored procedures, etc.

PreparedStatement PreparedStatement is a sub-interface of statement, which means a precompiled SQL statement object, that is, a "ready" statement. After the SQL statement is precompiled, there is a PreparedStatement object that can then be used efficiently to execute the statement multiple times. The PreparedStatement object can execute an SQL statement with parameters, that is, the object can assign values to the parameters in the SQL statement. It has various set methods that can assign values to parameters of different data types.

Statement Object Execution SQL statement

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.