版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進行舉報或認領(lǐng)
文檔簡介
1、 -18-外文原文Accessing Accessing and and Manipulating Manipulating Oracle Oracle Data DataThis chapter describes data access in oracle.sql.* formats, as opposed to standard Java formats. As described in the previous chapter
2、, the oracle.sql.* formats are a key factor of the Oracle JDBC extensions, offering significant advantages in efficiency and precision in manipulating SQL data.Using oracle.sql.* formats involves casting your result sets
3、 and statements to OracleResultSet, OracleStatement, OraclePreparedStatement, and OracleCallableStatement objects, as appropriate, and using the getOracleObject(), setOracleObject(), getXXX(), and setXXX() methods of the
4、se classes (where XXX corresponds to the types in the oracle.sql package). This chapter covers the following topics:Data Conversion ConsiderationsResult Set and Statement ExtensionsComparison of Oracle get and set Method
5、s to Standard JDBCUsing Result Set Meta Data ExtensionsData Conversion ConsiderationsWhen JDBC programs retrieve SQL data into Java, you can use standard Java types, or you can use types of the oracle.sql package. The cl
6、asses in this package simply wrap the raw SQL data.Standard Types versus Oracle TypesIn processing speed and effort, the oracle.sql.* classes provide the most efficient way of representing SQL data. These classes store t
7、he usual representations of SQL data as byte arrays. They do not reformat the data or perform any character-set conversions (aside from the usual network conversions) on it. The data remains in SQL format, and therefore
8、no information is lost. For SQL primitive types (such as NUMBER, and CHAR), the oracle.sql.* classes simply wrap the SQL data. For SQL structured types (such as objects and arrays), the classes provide additional informa
9、tion such as conversion methods and structure details. If you are moving data within the database, then you will probably want to keep your data in oracle.sql.* format. If you are displaying the data or performing -18-ja
10、va.sql.CallableStatement. If you want to apply only standard JDBC methods to the object, then keep it as a CallableStatement type. However, if you want to use the Oracle extensions on the object, you must cast it to an O
11、racleCallableStatement type. Although the type by which the Java compiler will identify the object is changed, the object itself is unchanged.You use the standard JDBC java.sql.Connection.prepareStatement() method to cre
12、ate a PreparedStatement object. If you want to apply only standard JDBC methods to the object, keep it as a PreparedStatement type. However, if you want to use the Oracle extensions on the object, you must cast it to an
13、OraclePreparedStatement type. While the type by which the Java compiler will identify the object is changed, the object itself is unchanged.Key extensions to the result set and statement classes include getOracleObject()
14、 and setOracleObject() methods that you can use to access and manipulate data in oracle.sql.* formats, instead of standard Java formats. For more information, see the next section: “Comparison of Oracle get and set Metho
15、ds to Standard JDBC“.Comparison of Oracle get and set Methods to Standard JDBC This section describes get and set methods, particularly the JDBC standard getObject() and setObject() methods and the Oracle-specific getOra
16、cleObject() and setOracleObject() methods, and how to access data in oracle.sql.* format compared with Java format.Although there are specific getXXX() methods for all the Oracle SQL types (as described in “Other getXXX(
17、) Methods“ on page 7-7), you can use the general get methods for convenience or simplicity, or if you are not certain in advance what type of data you will receive. Standard getObject() MethodThe standard JDBC getObject(
18、) method of a result set or callable statement returns data into a java.lang.Object object. The format of the data returned is based on its original type, as follows:For SQL datatypes that are not Oracle-specific, getObj
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預覽,若沒有圖紙預覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 眾賞文庫僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負責。
- 6. 下載文件中如有侵權(quán)或不適當內(nèi)容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
評論
0/150
提交評論