statement和preparedstatement的异同

statement和preparedstatement的异同

statement和preparedstatement的异同

相同点:

  • 二者都是接口,preparedstatement接口继承statement接口

  • 都是用来创建陈述对象的

     

区别

  statement preparedStatement
效率不同 效率低 效率高,因为使用了预编译
是否有注入漏洞 有(因为需要使用进行字符串拼接构成sql语句) 没有(使用参数绑定的方式构造sql语句)

猜你喜欢

转载自www.cnblogs.com/juddy/p/12823655.html