ISO/IEC 9075-10:2000
(Main)Information technology — Database languages — SQL — Part 10: Object Language Bindings (SQL/OLB)
Information technology — Database languages — SQL — Part 10: Object Language Bindings (SQL/OLB)
Technologies de l'information — Langages de base de données — SQL — Partie 10: Liaisons de langage objet (SQL/OLB)
General Information
Relations
Standards Content (Sample)
INTERNATIONAL ISO/IEC
STANDARD 9075-10
First edition
2000-11-01
Information technology — Database
languages — SQL —
Part 10:
Object Language Bindings (SQL/OLB)
Technologies de l'information — Langages de base de données — SQL —
Partie 10: Liaisons de langage objet (SQL/OLB)
Reference number
ISO/IEC 9075-10:2000(E)
©
ISO/IEC 2000
---------------------- Page: 1 ----------------------
ISO/IEC 9075-10:2000(E)
PDF disclaimer
This PDF file may contain embedded typefaces. In accordance with Adobe's 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 computer performing the editing. In downloading this
file, parties accept therein the responsibility of not infringing Adobe's 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 create 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 the Central Secretariat at the address given below.
© ISO/IEC 2000
All rights reserved. Unless otherwise specified, no part of this publication may be reproduced or utilized in any form or by any means, electronic
or mechanical, including photocopying and microfilm, without permission in writing from either ISO at the address below or ISO's member body
in the country of the requester.
ISO copyright office
Case postale 56 � CH-1211 Geneva 20
Tel. + 41 22 749 01 11
Fax + 41 22 749 09 47
E-mail copyright@iso.ch
Web www.iso.ch
Printed in Switzerland
ii © ISO/IEC 2000 – All rights reserved
---------------------- Page: 2 ----------------------
ISO/IEC 9075-10:2000(E)
Contents Page
Foreword . xviii
Introduction . . . . xix
1 Scope . 1
2 Normative references. 3
2.1 JTC 1 standards . . . 3
2.2 Publicly-available specifications . 3
3 Definitions, notations, and conventions . 5
3.1 Definitions . 5
3.1.1 Definitions provided in Part 10 . 5
3.2 Notations . 6
3.3 Conventions . 6
3.3.1 Use of terms. 6
3.3.1.1 Other terms . . 6
3.3.2 Relationships to other parts of ISO/IEC 9075 . 7
3.3.2.1 Clause, Subclause, and Table relationships . . . 7
3.4 Object identifier for Database Language SQL . 36
4 Concepts. 37
4.1 Introduction . 37
4.2 Embedded syntax . . 37
4.3 SQL constructs . . . . 38
4.4 Character strings . . 38
4.4.1 UNICODE support. 38
4.4.2 Named character sets . 39
4.5 Host variables . . . . 39
4.6 Host expressions . . 39
4.7 SQLJ clauses . 40
4.8 Database connection context . . 40
4.9 Default connection context . . . . 40
4.10 Schema checking using exemplar schemas. 41
4.11 Using multiple SQLJ contexts and connections . . . . 42
4.12 Dynamic SQL and JDBC/SQLJ Connection interoperability . . 42
4.12.1 Creating an SQLJ ConnectionContext from a JDBC connection . 42
© ISO/IEC 2000 – All rights reserved Contents iii
---------------------- Page: 3 ----------------------
ISO/IEC 9075-10:2000(E)
4.12.2 Obtaining a JDBC connection from an SQLJ ConnectionContext . 42
4.12.3 Connection sharing . 42
4.12.4 Connection resource management . 43
4.13 SQL execution control and status . 43
4.14 Iterators. 44
4.15 Input and output assignability. 45
4.16 Calls to stored procedures and functions . 54
4.17 Multiple JDBC ResultSet objects from stored procedure calls . 55
4.17.1 Resource management with multiple results . 55
4.18 JDBC/SQLJ ResultSet interoperability . . 55
4.18.1 Creating an SQLJ iterator from a JDBC ResultSet object . . . . 55
4.18.2 Obtaining a JDBC ResultSet object from an SQLJ iterator object . 56
4.18.3 Obtaining a JDBC ResultSet object from an untyped iterator object . 56
4.18.4 Iterator and JDBC ResultSet resource management . 57
4.19 Multi-threading considerations . 57
4.20 User-defined data types . 57
4.21 Batch updates . . . . 58
4.21.1 Batchable statements and batch compatibility. 58
4.21.2 Statement batching API. 59
4.21.3 Execution status and update counts. 60
4.21.4 Program semantics and exceptions . 60
4.21.5 Batch cancellation and disabling . 61
4.21.6 Specification of a batching limit . 61
4.22 SQLJ language elements . 62
4.22.1 . . . . 62
4.22.2 SQL schema, data, and transaction statements . . . . 63
4.22.3 . . . . 63
4.22.4 . . 63
4.22.5 . . . . 63
4.22.6 . 64
4.22.7 . 64
4.22.8 Cursor declaration . 64
4.22.9 Input parameters to SQL statements . . . . 65
4.22.10 Extracting column values from SQLJ iterators . . . . 65
4.22.11 and cursors . 65
5 Lexical elements . 67
5.1 . . . . 67
6 Scalar expressions . 69
6.1 and . . . 69
7 Additional common elements . 71
7.1 . 71
iv Object Language Bindings (SQL/OLB) © ISO/IEC 2000 – All rights reserved
---------------------- Page: 4 ----------------------
ISO/IEC 9075-10:2000(E)
8 Embedded SQL . 73
8.1 . 73
8.2 . 76
9 Binary portability. 77
9.1 Components of binary portable applications. 77
9.2 Naming runtime components . . 78
9.3 Binary portability requirements. 78
9.4 Profile overview . . . 79
9.5 Profile generation and naming . 80
9.5.1 Example. 81
9.6 SQLJ application packaging . . . 81
9.6.1 Example. 82
9.7 Profile customization overview. 83
9.7.1 Profile customization process . . 83
9.7.2 Profile customization utilities . . 84
9.7.3 Profile customizer interface . . . 84
9.8 Customization interface . 84
9.8.1 Customization usage . 85
9.8.2 Customization registration . . . . 86
9.9 EntryInfo overview. 87
9.10 TypeInfo overview . 89
9.11 SQLJ datatype properties . . . . 90
10 SQLJ grammar constructs. 93
10.1 Grammar notation . 93
10.2 Keyword and SQL case sensitivity rules . . 94
10.3 Commenting rules . 94
10.4 SQLJ reserved names . 94
10.4.1 Temporary variable names . . . . 94
10.4.2 Class and resource file names . 95
10.4.2.1 Internal classes . 95
10.4.2.2 Resource files and profiles . 96
10.5 Clause structure . . . 96
10.6 Common subelements . 97
10.6.1 . 97
10.6.2 . 97
10.6.3 . 97
10.6.4 . . . 98
10.6.5 . . . 98
10.6.6 . . 98
10.6.7 . 100
10.6.8 . . . . 100
© ISO/IEC 2000 – All rights reserved Contents v
---------------------- Page: 5 ----------------------
ISO/IEC 9075-10:2000(E)
11 and contents . 105
11.1 . 105
11.2 . 105
11.3 Generated connection class . . . 106
11.4 . . 110
11.5 . 111
11.6 Generated positioned iterator class . 112
11.7 . . 114
11.8 Generated named iterator class . 114
11.9 . 116
11.10 . . 121
11.11 . 122
11.12 . 123
11.13 . 124
11.14 . 125
11.15 . 128
11.16 . 131
11.17 . 133
11.18 . 133
11.19 . . . 134
11.20 . . 135
11.21 . 136
11.22 . . . . 137
11.23 . . 143
11.24 . . 145
12 Additional features. 149
12.1 SQL blocks. 149
12.2 sqlj . runtime . ExecutionContext . 150
13 Package sqlj . runtime. 151
13.1 SQLJ runtime interfaces . 151
13.1.1 sqlj . runtime . ConnectionContext . 151
13.1.1.1 Variables . . . . 152
13.1.1.1.1 CLOSE_CONNECTION . . 152
13.1.1.1.2 KEEP_CONNECTION . . . 152
13.1.1.2 Methods . 152
13.1.1.2.1 close ( ) . 152
13.1.1.2.2 close (boolean) . 153
13.1.1.2.3 getConnectedProfile (Object) . 153
13.1.1.2.4 getConnection ( ). 154
13.1.1.2.5 getExecutionContext ( ) . . 154
13.1.1.2.6 isClosed ( ) . . . 154
13.1.2 sqlj . runtime . ForUpdate . . . 154
13.1.2.1 Methods . 155
13.1.2.1.1 getCursorName ( ) . 155
vi Object Language Bindings (SQL/OLB) © ISO/IEC 2000 – All rights reserved
---------------------- Page: 6 ----------------------
ISO/IEC 9075-10:2000(E)
13.1.3 sqlj . runtime . NamedIterator . 155
13.1.4 sqlj . runtime . PositionedIterator. 155
13.1.4.1 Methods . 156
13.1.4.1.1 endFetch ( ) . . 156
13.1.5 sqlj . runtime . ResultSetIterator . 156
13.1.5.1 Variables . . . . 156
13.1.5.1.1 ASENSITIVE . 156
13.1.5.1.2 FETCH_FORWARD . 157
13.1.5.1.3 FETCH_REVERSE . 157
13.1.5.1.4 FETCH_UNKNOWN . . . . 157
13.1.5.1.5 INSENSITIVE . 157
13.1.5.1.6 SENSITIVE . . 157
13.1.5.2 Methods . 157
13.1.5.2.1 clearWarnings ( ) . 157
13.1.5.2.2 close ( ) . 158
13.1.5.2.3 getFetchSize ( ). 158
13.1.5.2.4 getResultSet ( ). 158
13.1.5.2.5 getRow ( ) . . . . 159
13.1.5.2.6 getSensitivity ( ) . 159
13.1.5.2.7 getWarnings (). 159
13.1.5.2.8 isClosed ( ) . . . 160
13.1.5.2.9 next ( ) . 160
13.1.5.2.10 setFetchSize (int) . 160
13.1.6 sqlj . runtime . Scrollable . . . . 162
13.1.6.1 Variables . . . . 162
13.1.6.2 Methods . 162
13.1.6.2.1 absolute (int) . 162
13.1.6.2.2 afterLast ( ) . . 162
13.1.6.2.3 beforeFirst ( ) . 162
13.1.6.2.4 first ( ) . 163
13.1.6.2.5 getFetchDirection ( ). 163
13.1.6.2.6 isAfterLast ( ) . 163
13.1.6.2.7 isBeforeFirst ( ) . 163
13.1.6.2.8 isFirst ( ) . . . . 164
13.1.6.2.9 isLast ( ) . 164
13.1.6.2.10 last ( ). 164
13.1.6.2.11 previous ( ) . . . 165
13.1.6.2.12 relative (int) . . 165
13.1.6.2.13 setFetchDirection (int) . . . 165
13.2 SQLJ Runtime Classes . 166
13.2.1 sqlj . runtime . AsciiStream . . 166
13.2.1.1 Constructors . . 166
13.2.1.1.1 AsciiStream (InputStream) . 166
13.2.1.1.2 AsciiStream (InputStream, int) . . . . 166
13.2.2 sqlj . runtime . BinaryStream . 167
© ISO/IEC 2000 – All rights reserved Contents vii
---------------------- Page: 7 ----------------------
ISO/IEC 9075-10:2000(E)
13.2.2.1 Constructors . . 167
13.2.2.1.1 BinaryStream (InputStream) . 167
13.2.2.1.2 BinaryStream (InputStream, int) . . . 167
13.2.3 sqlj . runtime . DefaultRuntime . 168
13.2.3.1 Constructors . . 168
13.2.3.1.1 DefaultRuntime ( ) . 168
13.2.3.2 Methods . 168
13.2.3.2.1 getDefaultConnection ( ) . . 168
13.2.3.2.2 getLoaderForClass (Class) . 168
13.2.4 sqlj . runtime . ExecutionContext . 169
13.2.4.1 Variables . . . . 169
13.2.4.1.1 ADD_BATCH_COUNT . . . 169
13.2.4.1.2 AUTO_BATCH. 169
13.2.4.1.3 EXEC_BATCH_COUNT . . 170
13.2.4.1.4 EXCEPTION_COUNT . . . 170
13.2.4.1.5 NEW_BATCH_COUNT . . 170
13.2.4.1.6 QUERY_COUNT . 170
13.2.4.1.7 UNLIMITED_BATCH . . . 171
13.2.4.2 Constructors . . 171
13.2.4.2.1 ExecutionContext ( ) . 171
13.2.4.3 Methods . 171
13.2.4.3.1 cancel ( ) . 171
13.2.4.3.2 execute ( ) . . . . 171
13.2.4.3.3 executeBatch ( ) . 173
13.2.4.3.4 executeQuery ( ) . 173
13.2.4.3.5 executeUpdate ( ) . 174
13.2.4.3.6 getBatchLimit ( ) . 175
13.2.4.3.7 getBatchUpdateCounts ( ) . 175
13.2.4.3.8 getFetchDirection ( ). 175
13.2.4.3.9 getFetchSize ( ). 176
13.2.4.3.10 getMaxFieldSize ( ). 176
13.2.4.3.11 getMaxRows ( ). 176
13.2.4.3.12 getNextResultSet ( ) . 177
13.2.4.3.13 getQueryTimeout ( ) . 177
13.2.4.3.14 getUpdateCount ( ) . 178
13.2.4.3.15 getWarnings (). 178
13.2.4.3.16 isBatching ( ) . 178
13.2.4.3.17 registerStatement (ConnectionContext, Object, int) . 179
13.2.4.3.18 releaseStatement ( ) . 180
13.2.4.3.19 setBatching (boolean) . . . . 180
13.2.4.3.20 setBatchLimit (int). 181
13.2.4.3.21 setFetchDirection (int) . . . 181
13.2.4.3.22 setFetchSize (int) . 182
13.2.4.3.23 setMaxFieldSize (int) . . . . 182
13.2.4.3.24 setMaxRows (int) . 182
viii Object Language Bindings (SQL/OLB) © ISO/IEC 2000 – All rights reserved
---------------------- Page: 8 ----------------------
ISO/IEC 9075-10:2000(E)
13.2.4.3.25 setQueryTimeout (int) . . . 183
13.2.5 sqlj . runtime . RuntimeContext . 183
13.2.5.1 Variables . . . . 183
13.2.5.1.1 DEFAULT_DATA_SOURCE. 183
13.2.5.1.2 DEFAULT_RUNTIME . . . 184
13.2.5.1.3 PROPERTY_KEY. 184
13.2.5.2 Constructors . . 184
13.2.5.2.1 RuntimeContext ( ) . 184
13.2.5.3 Methods . 184
13.2.5.3.1 getDefaultConnection ( ) . . 184
13.2.5.3.2 getLoaderForClass (Class) . 184
13.2.5.3.3 getRuntime ( ) . 185
13.2.6 sqlj . runtime . StreamWrapper . 185
13.2.6.1 Constructors . . 186
13.2.6.1.1 StreamWrapper (InputStream) . . . . 186
13.2.6.1.2 StreamWrapper (InputStream, int) . 186
13.2.6.2 Methods . 186
13.2.6.2.1 getInputStream ( ) . 186
13.2.6.2.2 getLength ( ) . . 186
13.2.6.2.3 setLength (int) . 187
13.2.7 sqlj . runtime . UnicodeStream . 187
13.2.7.1 Constructors . . 187
13.2.7.1.1 UnicodeStream (InputStream) . 187
13.2.7.1.2 UnicodeStream (InputStream, int) . . 188
13.2.8 sqlj . runtime . CharacterStream . 188
13.2.8.1 Constructors . . 188
13.2.8.1.1 CharacterStream (Reader) . 188
13.2.8.1.2 CharacterStream (Reader, int) . 188
13.2.8.2 Methods . 189
13.2.8.2.1 getReader ( ) . . 189
13.2.8.2.2 getLength ( ) . . 189
13.2.8.2.3 setLength (int) . 189
13.2.9 sqlj . runtime . SQLNullException . 189
13.2.9.1 Constructors . . 190
13.2.9.1.1 SQLNullException ( ) . . . . 190
14 Package sqlj . runtime . profile . 191
14.1 SQLJ sqlj . runtime . profile Interfaces . . 191
14.1.1 sqlj . runtime . profile . BatchContext . . 191
14.1.1.1 Methods . 191
14.1.1.1.1 clearBatch ( ) . 191
14.1.1.1.2 executeBatch ( ) . 191
14.1.1.1.3 setBatchLimit (int). 192
14.1.2 sqlj . runtime . profile . ConnectedProfile . 192
© ISO/IEC 2000 – All rights reserved Contents ix
---------------------- Page: 9 ----------------------
ISO/IEC 9075-10:2000(E)
14.1.2.1 Methods . 193
14.1.2.1.1 close ( ) . 193
14.1.2.1.2 getConnection ( ). 193
14.1.2.1.3 getProfileData ( ) . 194
14.1.2.1.4 getStatement (int, Map) . . 194
14.1.2.1.5 getStatement (int, BatchContext, Map) . 194
14.1.3 sqlj . runtime . profile . Customization . . 195
14.1.3.1 Methods . 196
14.1.3.1.1 acceptsConnection (Connection) . . . . 196
14.1.3.1.2 getProfile (Connection, Profile). 196
14.1.4 sqlj . runtime . profile . Loader. 197
14.1.4.1 Methods . 197
14.1.4.1.1 getResourceAsStream (String) . 197
14.1.4.1.2 loadClass (String). 197
14.1.5 sqlj . runtime . profile . RTResultSet . . . 198
14.1.5.1 Methods . 201
14.1.5.1.1 clearWarnings ( ) . 201
14.1.5.1.2 close ( ) . 201
14.1.5.1.3 findColumn (String) . 201
14.1.5.1.4 getAsciiStreamWrapper (int) . 202
14.1.5.1.5 getBigDecimal (int) . 203
14.1.5.1.6 getBinaryStreamWrapper (int). 203
14.1.5.1.7 getBlob (int) . . 204
14.1.5.1.8 getBooleanNoNull (int) . . 205
14.1.5.1.9 getBooleanWrapper (int) . 206
14.1.5.1.10 getByteNoNull (int) . 2
...
Questions, Comments and Discussion
Ask us and Technical Secretary will try to provide an answer. You can facilitate discussion about the standard in here.