- 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:

- 3ds Max 2016中文版完全自學手冊
- Adobe創(chuàng)意大學After Effects CS5 影視特效師標準實訓教材
- Apache OFBiz Development: The Beginner's Tutorial
- 零基礎玩轉AI繪畫
- 零基礎學后期:Photoshop+Lightroom數(shù)碼照片處理從新手到高手
- 綁定的藝術:Maya高級角色骨骼綁定技法(第2版)
- Premiere Pro CC 2018基礎教程(第3版)
- SOLIDWORKS中文版實用教程
- Refactoring with Microsoft Visual Studio 2010
- Adobe創(chuàng)意大學Premiere Pro影視剪輯師標準實訓教材(CS6修訂版)
- Illustrator CC 2018 基礎與實戰(zhàn)教程(全彩版)
- Joomla! 1.6 First Look
- Photoshop CS6圖像處理立體化教程
- Jasmine JavaScript Testing
- Getting Started with Oracle Hyperion Planning 11