- JDBC 4.0 and Oracle JDeveloper for J2EE Development
- Deepak Vohra
- 174字
- 2021-08-25 18:08:45
PreparedStatement Interface
A PreparedStatement
object represents a precompiled SQL statement. The PreparedStatement
interface extends the Statement
interface. The precompiled SQL statement has IN
parameters for which values are being set with the setter methods of the PreparedStatement
interface. A 'setter' method is included for each of the Java data types that map to a SQL data type. The JDBC driver converts the Java data type to an SQL data type. The IN
parameter values are set with parameter index. For example, update a Catalog
table with the following definition using PreparedStatement
:
CatalogId NUMBER Journal VARCHAR(255) Publisher VARCHAR(255) Title VARCHAR(255) Author VARCHAR(255)
Set Publisher
column value to Oracle Publishing
, and Journal
column values to Oracle Magazine
, where CatalogId
is 1, referred to the code below:
PreparedStatement pstmt = connection.prepareStatement("UPDATE CATALOG SET Journal=? AND Publisher=? WHERE CatalogId=?"); pstmt.setString(1, "Oracle Magazine"); pstmt.setString(2, "Oracle Publishing"); pstmt.setInt(3, 1); pstmt.executeUpdate();
If the database supports statement pooling, PreparedStatement
objects are pooled by default. In JDBC 4.0, the methods discussed in the following table have been added to the PreparedStatement
interface:

- 基于元胞自動(dòng)機(jī)的城市路網(wǎng)交通流建模與仿真
- AJAX and PHP: Building Modern Web Applications 2nd Edition
- 架構(gòu)之美
- Hi!扁平化Photoshop扁平化用戶界面設(shè)計(jì)教程
- Spring Web Flow 2 Web Development
- 中文版Maya 2022完全自學(xué)教程
- Procreate+ SketchUp +Photoshop建筑設(shè)計(jì)手繪表現(xiàn)技法
- SketchUp/Piranesi印象彩繪表現(xiàn)項(xiàng)目實(shí)踐
- 中文版Photoshop CC平面設(shè)計(jì)從入門(mén)到精通(唯美)
- Lighttpd
- Photoshop網(wǎng)店圖片處理實(shí)訓(xùn)教程
- 三維建模與3D打印從入門(mén)到精通
- 邊做邊學(xué):平面設(shè)計(jì)(Photoshop CS6 +CorelDRAW X6)
- Solid Edge 機(jī)械設(shè)計(jì)基礎(chǔ)及應(yīng)用
- Photoshop手繪從新手到高手