Statements、PreparedStatement及CallableStatement(三)

当获得了与数据库的连接后,就可以与数据库进行交互了。
JDBC Statement,CallableStatement和PreparedStatement接口定义了可用于发送SQL或PL/SQL命令,并从数据库接收数据的方法和属性。

  • Statement:用于对数据库进行通用访问,在运行时使用静态SQL语句时很有用。 Statement接口不能接受参数。
  • PreparedStatement:当计划要多次使用SQL语句时使用。PreparedStatement接口在运行时接受输入参数。
  • CallableStatement:当想要访问数据库存储过程时使用。CallableStatement接口也可以接受运行时输入参数。

一、 Statement对象

猜你喜欢

转载自www.cnblogs.com/myitnews/p/11841208.html