Not the answer you need?
Register and ask your own question!
Many Forum changes were implemented on Tue 22 Sep. Read about new Ranks, Scoring, and Reactions.
Email [email protected] for any comments or concerns.

prepared statements in MySQL

mikecmikec ContributorInactive User Role Beginner
Is there any advantage to using prepared statements in Java for DML in the following

get a connection, prepare a statement, substitute the variable value, execute, close the
statement - repeat this process over and over.

Don’t you need to not close so that you don’t have to re-prepare the statement
in order to gain any performance advantage?


  • sterinsterin Mentor Inactive User Role Contributor
    That is correct, you need to hold the handle for the prepared statement and re-execute it with just different values each time.

    prepare statementLOOP: execute statement with different valuesEND:close statement.</pre>
Sign In or Register to comment.

MySQL, InnoDB, MariaDB and MongoDB are trademarks of their respective owners.
Copyright ©2005 - 2020 Percona LLC. All rights reserved.