1、BSI Standards PublicationPD ISO/IEC TR 19075-3:2015Information technology Database languages SQL T e c h n i c a l R e p o r t sPart 3: SQL Embedded in Programs using the JavaTMprogramming languagePD ISO/IEC TR 19075-3:2015 PUBLISHED DOCUMENTNational forewordThis Published Document is the UK impleme
2、ntation of ISO/IEC TR 19075-3:2015.The UK participation in its preparation was entrusted to Technical Committee IST/40, Data management and interchange.A list of organizations represented on this committee can be obtained on request to its secretary.This publication does not purport to include all t
3、he necessary provisions of a contract. Users are responsible for its correct application. The British Standards Institution 2015.Published by BSI Standards Limited 2015ISBN 978 0 580 85111 7 ICS 35.060 Compliance with a British Standard cannot confer immunity from legal obligations.This Published Do
4、cument was published under the authority of the Standards Policy and Strategy Committee on 31 July 2015.Amendments/corrigenda issued since publicationDate T e x t a f f e c t e dInformation technology Database languages SQL Technical Reports Part 3: SQL Embedded in Programs using the JavaTMprogrammi
5、ng languageTechnologies de linformation Langages de base de donnes SQL rapports techniques Partie 3: SQL intgres dans des programmes utilisant le langage de programmation de JavaTMTECHNICAL REPORTISO/IEC TR 19075-3First edition 2015-07-01Reference number ISO/IEC TR 19075-3:2015(E) ISO/IEC 2015PD ISO
6、/IEC TR 19075-3:2015ii ISO/IEC 2015 All rights reservedCOPYRIGHT PROTECTED DOCUMENT ISO/IEC 2015, Published in SwitzerlandAll rights reserved. Unless otherwise specified, no part of this publication may be reproduced or utilized otherwise in any form or by any means, electronic or mechanical, includ
7、ing photocopying, or posting on the internet or an intranet, without prior written permission. Permission can be requested from either ISO at the address below or ISOs member body in the country of the requester.ISO copyright officeCh. de Blandonnet 8 CP 401CH-1214 Vernier, Geneva, SwitzerlandTel. +
8、41 22 749 01 11Fax +41 22 749 09 47copyrightiso.orgwww.iso.orgISO/IEC TR 19075-3:2015(E)PD ISO/IEC TR 19075-3:2015Contents PageForeword. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
9、 . . . vIntroduction. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . vi1 Scope. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
10、 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 Normative references. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32.1 ISO and IEC standards. . . . . . . . . . . . . . . . . . . . . . . .
11、. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32.2 Other international standards. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33 Use of SQL in programs written in Java. . . . . .
12、 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53.1 Design goals. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53.2 Advantages of SQL/OLB over JDBC
13、. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53.3 Consistency with existing embedded SQL languages. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63.4 Profile customization overview. . . . .
14、. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63.4.1 Profile customization process. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73.4.2 Profile customizati
15、on utilities. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83.5 Examples. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
16、 . . . . 83.5.1 Example of Profile generation and naming. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83.5.2 Example of a JAR manifest file. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
17、 . . . . . . . . . 83.5.3 Host variables. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93.5.4 Host expressions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
18、 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93.5.5 SQL/OLB clauses. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103.5.6 Connection contexts. . . . . . . . . . . . . . . . . . . . . . . . .
19、. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103.5.7 Default connection context. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103.5.8 Iterators. . . . . . . . . . . . . . . . .
20、 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113.5.8.1 Positional bindings to columns. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113.5.8.2 Named
21、 bindings to columns. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123.5.8.3 Providing names for columns of queries. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 133.
22、5.9 Invoking SQL-invoked routines. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 133.5.10 Using multiple SQL/OLB contexts and connections. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 143
23、.5.11 SQL execution control and status. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 153.5.12 Multiple java.sql.ResultSet objects from SQL-invoked procedure calls. . . . . . . . . . . . . . . . . . . . . . 163.5.13 Creating an SQ
24、L/OLB iterator object from a java.sql.ResultSet object. . . . . . . . . . . . . . . . . . . . . . 173.5.14 Obtaining a java.sql.ResultSet object from an iterator object. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 173.5.15 Working with user-defined types. . . . . . . . . . . . . . . .
25、. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 183.5.16 Batching. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 193.5.17 Example program. . . . . . . . .
26、 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 193.5.18 Host variable definition. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20ISO/IE
27、C 2014 All rights reserved Contents iiiDTR 19075-3:2014(E)PD ISO/IEC TR 19075-3:2015 ISO/IEC TR 19075-3:2015(E) PD ISO/IEC TR 19075-3:2015Index. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
28、 . . . . . . . . . 23iv SQL Embedded in Programs Using the the Java Programming Language ISO/IEC 2014 All rights reservedDTR 19075-3:2014(E)PD ISO/IEC TR 19075-3:2015 ISO/IEC TR 19075-3:2015(E) PD ISO/IEC TR 19075-3:2015ForewordISO (the International Organization for Standardization) and IEC (the In
29、ternational Electrotechnical Commission)form the specialized system for worldwide standardization. National bodies that are members of ISO or IECparticipate in the development of International Standards through technical committees established by therespective organization to deal with particular fi
30、elds of technical activity. ISO and IEC technical committeescollaborate in fields of mutual interest. Other international organizations, governmental and non-governmental,in liaison with ISO and IEC, also take part in the work. In the field of information technology, ISO and IEChave established a jo
31、int technical committee, ISO/IEC JTC 1.International Standards are drafted in accordance with the rules given in the ISO/IEC Directives, Part 2.The main task of the joint technical committee is to prepare International Standards. Draft International Standardsadopted by the joint technical committee
32、are circulated to national bodies for voting. Publication as an Interna-tional Standard requires approval by at least 75 % of the national bodies casting a vote.In exceptional circumstances, when the joint technical committee has collected data of a different kind fromthat which is normally publishe
33、d as an International Standard (“state of the art”, for example), it may decideto publish a Technical Report. A Technical Report is entirely informative in nature and shall be subject toreview every five years in the same manner as an International Standard.Attention is drawn to the possibility that
34、 some of the elements of this document may be the subject of patentrights. ISO and IEC shall not be held responsible for identifying any or all such patent rights.ISO/IEC TR 19075-3 was prepared by Joint Technical Committee ISO/IEC JTC 1, Information technology,Subcommittee SC 32, Data management an
35、d interchange.ISO/IEC TR 19075 consists of the following parts, under the general title Information technology Databaselanguages SQL Technical Reports: Part 1: XQuery Regular Expression Support in SQL Part 2: SQL Support for Time-Related Information Part 3: SQL Embedded in Programs Using the Java Pr
36、ogramming Language Part 4: SQL With Routines and Types Using the Java Programming Language Part 5: Row Pattern Recognition in SQLNOTE 1 The individual parts of multi-part technical reports are not necessarily published together. New editions of one or moreparts may be published without publication o
37、f new editions of other parts.ISO/IEC 2014 All rights reserved Foreword vDTR 19075-3:2014(E)PD ISO/IEC TR 19075-3:2015 ISO/IEC TR 19075-3:2015(E) PD ISO/IEC TR 19075-3:2015IntroductionThe organization of this part of ISO/IEC 19075 is as follows:1) Clause 1, “Scope”, specifies the scope of this part
38、of ISO/IEC 19075.2) Clause 2, “Normative references”, identifies additional standards that, through reference in this part ofISO/IEC 19075, constitute provisions of this part of ISO/IEC 19075.3) Clause 3, “Use of SQL in programs written in Java”, provides a tutorial on the embedding of SQLexpression
39、s and statements in programs written in the Java programming language.vi SQL Embedded in Programs Using the the Java Programming Language ISO/IEC 2014 All rights reservedDTR 19075-3:2014(E)PD ISO/IEC TR 19075-3:2015 ISO/IEC TR 19075-3:2015(E) PD ISO/IEC TR 19075-3:2015TECHNICAL REPORT ISO/IEC DTR 19
40、075-3:2014Information technology Database languages SQL Technical Reports Part 3:SQL Embedded in Programs Using the Java Programming Language1 ScopeThis Technical Report describes the support for the use of SQL within programs written in Java.The Report discusses the following features of the SQL La
41、nguage: The embedding of SQL expressions and statements in programs written in the Java programming languageISO/IEC 2014 All rights reserved Scope 1PD ISO/IEC TR 19075-3:2015 ISO/IEC TR 19075-3:2015(E) PD ISO/IEC TR 19075-3:2015(Blank page)2 SQL Embedded in Programs Using the the Java Programming La
42、nguage ISO/IEC 2014 All rights reservedDTR 19075-3:2014(E)PD ISO/IEC TR 19075-3:2015 ISO/IEC TR 19075-3:2015(E) PD ISO/IEC TR 19075-3:20152 Normative referencesThe following referenced documents are indispensable for the application of this document. For dated references,only the edition cited appli
43、es. For undated references, the latest edition of the referenced document (includingany amendments) applies.2.1 ISO and IEC standardsISO9075-1 ISO/IEC 9075-1:2011, Information technology Database languages SQL Part 1:Framework (SQL/Framework).ISO9075-2 ISO/IEC 9075-2:2011, Information technology Dat
44、abase languages SQL Part 2:Foundation (SQL/Foundation).ISO9075-10 ISO/IEC 9075-10:2008, Information technology Database languages SQL Part 10:Object Language Bindings (SQL/OLB).2.2 Other international standardsUnicode The Unicode Consortium, The Unicode Standard. (Information about the latest versio
45、n of theUnicode standard can be found by using the “Latest Unicode Version“ link on the “Enumerated Versions ofThe Unicode Standard“ page.)http:/www.unicode.org/versions/enumeratedversions.htmlJava The Java Language Specification, Third Edition, James Gosling, Bill Joy, Guy Steele, and GiladBracha,
46、Prentice Hall, June 14, 2005, ISBN 0-321-24678-0.JDBC JDBC 4.0 Specification, Final v1.0, Lance Andersen, Sun Microsystems, Inc., November 7, 2006.JNDI Java Naming and Directory Interface, Sun Microsystems, Inc. http:/ The JavaBeans 1.01 Specificationhttp:/ 2014 All rights reserved Normative referen
47、ces 3DTR 19075-3:2014(E)2.1 ISO and IEC standardsPD ISO/IEC TR 19075-3:2015 ISO/IEC TR 19075-3:2015(E) PD ISO/IEC TR 19075-3:2015(Blank page)4 SQL Embedded in Programs Using the the Java Programming Language ISO/IEC 2014 All rights reservedDTR 19075-3:2014(E)PD ISO/IEC TR 19075-3:2015 ISO/IEC TR 190
48、75-3:2015(E) PD ISO/IEC TR 19075-3:20153 Use of SQL in programs written in Java3.1 Design goalsThe following items represent the major design features of ISO9075-10. Provide a concise, legible mechanism for embedding SQL-statements in a program that otherwise conformsto Java. Syntactic and semantic
49、check of SQL-statements prior to program execution.SQL/OLB can use an implementation-defined mechanism at translate time to check embedded SQL-statements to make sure that they are syntactically and semantically correct. Allow the syntax and semantics of SQL-statements to be location-independent.The syntax and semantics of SQL-statements in an SQL/OLB pro
copyright@ 2008-2019 麦多课文库(www.mydoc123.com)网站版权所有
备案/许可证编号:苏ICP备17064731号-1