zoukankan      html  css  js  c++  java
  • Statement VS PrepareStatement

    Many relation database handle a JDBC sql query in blew four steps:

    1, parse the incoming sql

    2, compile the sql

    3, plan/ optimize the sql.

    4, execute the sql and return data

    A Statement will always procceed the four steps for each sql quer sent to the database. A PrepareStatement will pre-execute the steps 1-3.

    Thus, when creating a PreparedStatement some pre-optimization is performed immediately. 

    Another advantage of the PreparedStatement class is the ability to create an incomplete query and supply parameter values at execution time. This type of query is well suited for filtering queries which may differ in parameter value only: 

    preparedStatement also will avoid some sql injection risk.

    callablestatement extend the preparestatement, it can excute a procedure.

  • 相关阅读:
    OC
    OC
    核心动画
    核心动画
    核心动画
    数据存储1
    plsql语句基础
    Oracle3连接&子查询&联合查询&分析函数
    oracle2约束添加&表复制&拼接
    Oracle表空间创建及表创建
  • 原文地址:https://www.cnblogs.com/zhonghan/p/3597262.html
Copyright © 2011-2022 走看看