与Statement相比,使用Preparedstatement有任何不利之处吗? [英] Are there any disadvantages using Preparedstatement compared to Statement
问题描述
我正在遍历JDBC中Statement和PreparedStatement之间的差异,并在此处和此处与PreparedStatement与Statement进行比较.
I was going through differences between Statement and PreparedStatement in JDBC and saw so many advantages here and here with PreparedStatement in comparison with Statement.
我的一些同事在问为什么我们仍然需要Statement以及为什么不赞成使用PreparedStatement的优点.
Some of my colleague was asking why we still need Statement and why it is not deprecated looking at the advantages of PreparedStatement.
那么有什么原因使我们仍然在JDBC API中使用该语句?
So is there any reason why we still have the Statement in JDBC API?
推荐答案
PreparedStatement
用于处理动态SQL查询,而Statement
用于处理静态SQL查询.
PreparedStatement
is used to handle the dynamic SQL queries, where Statement
is used to handle static SQL queries.
这篇关于与Statement相比,使用Preparedstatement有任何不利之处吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!