与Statement相比,使用Preparedstatement有任何不利之处吗? [英] Are there any disadvantages using Preparedstatement compared to Statement

查看:168
本文介绍了与Statement相比,使用Preparedstatement有任何不利之处吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在遍历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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆