1、 INCITS/ISO/IEC 9075-10:2008 R2013 (ISO/IEC 9075-10:2008, IDT) Information technology Database languages SQL Part 10: Object language bindings (SQL/OLB) Copyright American National Standards Institute Provided by IHS under license with ANSI Not for ResaleNo reproduction or networking permitted witho
2、ut license from IHS-,-,-INCITS/ISO/IEC 9075-10:2008 R2013 PDF disclaimer This PDF file may contain embedded typefaces. In accordance with Adobes licensing policy, this file may be printed or viewed but shall not be edited unless the typefaces which are embedded are licensed to and installed on the c
3、omputer performing the editing. In downloading this file, parties accept therein the responsibility of not infringing Adobes licensing policy. The ISO Central Secretariat accepts no liability in this area. Adobe is a trademark of Adobe Systems Incorporated. Details of the software products used to c
4、reate this PDF file can be found in the General Info relative to the file; the PDF-creation parameters were optimized for printing. Every care has been taken to ensure that the file is suitable for use by ISO member bodies. In the unlikely event that a problem relating to it is found, please inform
5、the Central Secretariat at the address given below. Adopted by INCITS (InterNational Committee for Information Technology Standards) as an American National Standard. Date of ANSI Approval: 4/11/2013 Published by American National Standards Institute, 25 West 43rd Street, New York, New York 10036 Co
6、pyright 2013 by Information Technology Industry Council (ITI). All rights reserved. These materials are subject to copyright claims of International Standardization Organization (ISO), International Electrotechnical Commission (IEC), American National Standards Institute (ANSI), and Information Tech
7、nology Industry Council (ITI). Not for resale. No part of this publication may be reproduced in any form, including an electronic retrieval system, without the prior written permission of ITI. All requests pertaining to this standard should be submitted to ITI, 1250 Eye Street NW, Washington, DC 200
8、05. Printed in the United States of America ii ITIC 2013 All rights reserved Copyright American National Standards Institute Provided by IHS under license with ANSI Not for ResaleNo reproduction or networking permitted without license from IHS-,-,-Contents PageForeword. . . . . . . . . . . . . . . .
9、 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xixIntroduction. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
10、. . . . . . . . . . xx1 Scope. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 Normative references. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
11、. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32.1 ISO and IEC standards. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32.2 Other international standards. . . . . . . . . . . . . . . . . . . . . .
12、. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33 Definitions, notations, and conventions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53.1 Definitions. . . . . . . . . . . . . . . . . . . . . . . . . .
13、. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53.1.1 Definitions provided in Part 10. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53.2 Conventions. . . . . . . . . .
14、. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63.2.1 Use of terms. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
15、 . 73.2.1.1 Other terms. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73.2.2 Specification of translator-generated classes. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
16、 . . . . . . . . . . . . . . 74 Concepts. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94.1 Embedded syntax. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
17、. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94.2 Character strings. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94.2.1 Unicode support. . . . . . . . . . . . . . . . . . . . . .
18、. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94.2.2 Character sets. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104.3 Introduction to SQLJ. .
19、 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104.3.1 Overview. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
20、 . . 104.3.2 SQL constructs. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104.3.3 SQLJ clauses. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
21、 . . . . . . . . . . . . . . . . . . . . . 114.3.4 Binary portability. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 114.3.4.1 Binary portability requirements. . . . . . . . . . . . . . . . . . . . . . . .
22、. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 114.3.4.2 Components of binary portable applications. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 134.3.5 Profile overview. . . . . . . . . . . . . . . . . . . . . . . . . . . .
23、. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 134.3.5.1 EntryInfo overview. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 144.3.5.2 TypeInfo overview. . . . . . . . . .
24、 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 174.3.5.3 SQLJ datatype properties. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 184.3.6 Host variab
25、les. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 204.3.7 Host expressions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
26、 . . . . . . . . . 204.3.8 Connection contexts. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 214.3.9 Default connection context. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
27、. . . . . . . . . . . . . . . . . . . . . . . 214.3.10 Schema checking using exemplar schemas. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 224.3.11 Using multiple SQLJ contexts and connections. . . . . . . . . . . . . . . . . . . . . . . . . .
28、. . . . . . . . . . . . . . . . . . . . . . 22 ISO/IEC 2008 All rights reserved Contents iiiISO/IEC 9075-10:2008(E)Copyright American National Standards Institute Provided by IHS under license with ANSI Not for ResaleNo reproduction or networking permitted without license from IHS-,-,-4.3.12 Dynamic
29、 SQL and JDBC/SQLJ Connection interoperability. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 224.3.12.1 Creating an SQLJ ConnectionContext from a java.sql.Connection object. . . . . . . . . . . . . . . . . . . 234.3.12.2 Obtaining a java.sql.Connection object from an SQLJ
30、ConnectionContext. . . . . . . . . . . . . . . . . . 234.3.12.3 Connection sharing. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 234.3.12.4 Connection resource management. . . . . . . . . . . . . . . . . . . .
31、 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 234.3.13 SQL execution control and status. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 244.3.14 Iterators. . . . . . . . . . . . . . . . . . . . . . . .
32、. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 244.3.15 Input and output assignability. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 264.3.16 Multiple java.sql.
33、ResultSet objects from SQL-invoked procedure calls. . . . . . . . . . . . . . . . . . . . . . 394.3.16.1 Resource management with multiple results. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 394.3.17 JDBC/SQLJ ResultSet interoperability. . . . . .
34、 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 394.3.17.1 Creating an SQLJ iterator from a java.sql.ResultSet object. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 394.3.17.2 Obtaining a java.sql.ResultSet object from an SQLJ iterator obj
35、ect. . . . . . . . . . . . . . . . . . . . . . . . 404.3.17.3 Obtaining a java.sql.ResultSet object from an untyped iterator object. . . . . . . . . . . . . . . . . . . . . . 404.3.17.4 Iterator and java.sql.ResultSet object resource management. . . . . . . . . . . . . . . . . . . . . . . . . . . .
36、. . 404.3.18 Multi-threading considerations. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 414.3.19 User-defined data types. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
37、 . . . . . . . . . . . . . . . 414.3.20 Batch updates. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 424.3.20.1 Batchable statements and batch compatibility. . . . . . . . . . . . . . . . . . . . . .
38、. . . . . . . . . . . . . . . . . . . . . . . . . . 424.3.20.2 Statement batching API. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 434.3.20.3 Execution status and update counts. . . . . . . . . . . . . . . . . . . .
39、. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 434.3.20.4 Program semantics and exceptions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 444.3.20.5 Batch cancellation and disabling. . . . . . . . . . . . . .
40、. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 454.3.20.6 Specification of a batching limit. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 454.3.21 SQLJ language elements. . . . . . . . . .
41、 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 464.3.21.1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 464.3.21.2 SQL-schema, SQL-data,
42、 and SQL-transaction statements. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 464.3.21.3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 464.3.21.4 . . . . . . . . . . . . . . . . . . . . . .
43、 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 474.3.21.5 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 474.3.21.6 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
44、 . . . . . . . . . . . . . . . . . . . . 474.3.21.7 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 484.3.21.8 Cursor declaration. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
45、 . . . . . . . . . . . . . . . . . . . . 484.3.21.9 Input parameters to SQL-statements. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 484.3.21.10 Extracting column values from SQLJ iterators. . . . . . . . . . . . . . . . . . . . . . . .
46、. . . . . . . . . . . . . . . . . . . . . . . 484.3.21.11 and cursors. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 494.3.22 SQLJ, JDBC, and SQLExceptions and SQLWarnings. . . . . . . . . . . . . . . . . . . . . . . . . . . . .
47、 . . . . . . . . . . . . . . 494.3.23 Profile generation and naming. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 494.3.24 SQLJ application packaging. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
48、. . . . . . . . . . . . . . . . . . . . . . . . . 504.3.25 Profile customizer interface. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 514.3.26 Customization interface. . . . . . . . . . . . . . . . . . . . . . . . . . . .
49、 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 524.3.26.1 Customization usage. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 524.3.26.2 Customization registration. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .