Statement和PreparedStatement区别

根据网上资料总结如下:

1、在对数据库只执行一次性存取的时候,用Statement对象进行处理。因为PreparedStatement对象的开销比Statement大,对于一次性操作并不会带来额外的好处。
2、Statement每次执行SQL语句,相关数据库都要执行SQL语句的编译; PreparedStatement是预编译的,对于批量处理可以大大提高效率. 也叫JDBC存储过程
3、PrepareStatement可以替换变量,代码可读性比较高。

批量查询举例链接:

http://blog.csdn.net/iloveyin/article/details/6954691

猜你喜欢

转载自blog.csdn.net/chj97/article/details/23181697