Difference between Statement and PreparedStatement

前端 未结 15 1331
野的像风
野的像风 2020-11-22 02:49

The Prepared Statement is a slightly more powerful version of a Statement, and should always be at least as quick and easy to handle as a Statement.
The Prepared Stateme

15条回答
  •  独厮守ぢ
    2020-11-22 03:20

    nothing much to add,

    1 - if you want to execute a query in a loop (more than 1 time), prepared statement can be faster, because of optimization that you mentioned.

    2 - parameterized query is a good way to avoid SQL Injection. Parameterized querys are only available in PreparedStatement.

提交回复
热议问题