The difference between JDBC Createstatament and preparestatament

Source: Internet
Author: User
Tags sql injection stmt
Preparestatament is more secure and effective in preventing SQL injection, preparestatament is more efficient for statements that are repeatedly executed more efficiently when executing a variable parameter of SQL, PreparedStatement is more efficient than statement , because it is certainly more efficient for a DBMS to precompile a SQL than to compile one SQL multiple times preparestatament can use variables in SQL statements, for example: statament stmt = conn. Preparestatement ("Select * from tabs where id=?") and tab_name=? ") To Assignment, the first parameter represents? Location The second parameter represents to that? The value passed is Stmt.setint (1, 1); Stmt.setstring ("Test", "TEST_JDBC"); Preparestament executes the DDL statement to use the Execute () method, which returns a Boolean value. True if execution of DDL succeeds otherwise false

The difference between JDBC Createstatament and preparestatament

Related Article

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.