@@ -191,22 +191,22 @@ are supported by Oracle R2DBC:
191191 - ` HOST `
192192 - ` PORT `
193193 - ` DATABASE `
194+ - The database option is interpreted as the
195+ [ service name] ( https://docs.oracle.com/en/database/oracle/oracle-database/21/netag/identifying-and-accessing-database.html#GUID-153861C1-16AD-41EC-A179-074146B722E6 )
196+ of an Oracle Database instance. _ System Identifiers (SID) are not recognized_ .
194197 - ` USER `
195198 - ` PASSWORD `
196199 - ` SSL `
197200 - ` CONNECT_TIMEOUT `
198201 - ` STATEMENT_TIMEOUT ` .
199-
200- > Oracle R2DBC interprets the ` DATABASE ` option as the
201- > [ service name] ( https://docs.oracle.com/en/database/oracle/oracle-database/21/netag/identifying-and-accessing-database.html#GUID-153861C1-16AD-41EC-A179-074146B722E6 )
202- > of an Oracle Database instance. _ System Identifiers (SID) are not recognized_ .
202+ - ` PROTOCOL `
203+ - (For inclusion in the next release) Accepted protocol values are "tcps", "ldap", and "ldaps"
203204
204205#### Support for Extended R2DBC Options
205206Oracle R2DBC extends the standard set of R2DBC options to offer functionality
206207that is specific to Oracle Database and the Oracle JDBC Driver. Extended options
207208are declared in the
208- [ OracleR2dbcOptions] ( src/main/java/oracle/r2dbc/OracleR2dbcOptions.java )
209- class.
209+ [ OracleR2dbcOptions] ( src/main/java/oracle/r2dbc/OracleR2dbcOptions.java ) class.
210210
211211#### Configuring an Oracle Net Descriptor
212212The ` oracle.r2dbc.OracleR2dbcOptions.DESCRIPTOR ` option may be used to configure
@@ -234,6 +234,22 @@ located:
234234r2dbc:oracle://?oracle.r2dbc.descriptor=myAlias&TNS_ADMIN=/path/to/tnsnames/
235235```
236236
237+ #### (For inclusion in the next release) Configuring an LDAP URL
238+ Use ` ldap ` or ` ldaps ` as the URL protocol to have an Oracle Net Descriptor
239+ retrieved from an LDAP server:
240+ ```
241+ r2dbc:oracle:ldap://ldap.example.com:7777/sales,cn=OracleContext,dc=com
242+ r2dbc:oracle:ldaps://ldap.example.com:7778/sales,cn=OracleContext,dc=com
243+ ```
244+ Use a space separated list of LDAP URIs for fail over and load balancing:
245+ ```
246+ r2dbc:oracle:ldap://ldap1.example.com:7777/sales,cn=OracleContext,dc=com%20ldap://ldap2.example.com:7777/sales,cn=OracleContext,dc=com%20ldap://ldap3.example.com:7777/sales,cn=OracleContext,dc=com
247+ ```
248+ > Space characters in a URL must be percent encoded as ` %20 `
249+
250+ An LDAP server request will ** block a thread for network I/O** when Oracle R2DBC
251+ creates a new connection.
252+
237253#### Configuring a java.util.concurrent.Executor
238254The ` oracle.r2dbc.OracleR2dbcOptions.EXECUTOR ` option configures a
239255` java.util.concurrent.Executor ` for executing asynchronous callbacks. The
@@ -344,12 +360,32 @@ Oracle R2DBC's implementation of Publishers that emit multiple items will
344360typically defer execution until a Subscriber signals demand, and not support
345361multiple subscribers.
346362
347- ### Errors
363+ ### Errors and Warnings
348364Oracle R2DBC creates R2dbcExceptions having the same ORA-XXXXX error codes
349- used by Oracle Database and Oracle JDBC.
365+ used by Oracle Database and Oracle JDBC. The
366+ [ Database Error Messages] ( https://docs.oracle.com/en/database/oracle/oracle-database/21/errmg/ORA-00000.html#GUID-27437B7F-F0C3-4F1F-9C6E-6780706FB0F6 )
367+ document provides a reference for all ORA-XXXXX error codes.
350368
351- A reference for the ORA-XXXXX error codes can be found
352- [ here] ( https://docs.oracle.com/en/database/oracle/oracle-database/21/errmg/ORA-00000.html#GUID-27437B7F-F0C3-4F1F-9C6E-6780706FB0F6 )
369+ Warning messages from Oracle Database are emitted as
370+ ` oracle.r2dbc.OracleR2dbcWarning ` segments. These segments may be consumed using
371+ ` Result.flatMap(Function) ` :
372+ ``` java
373+ result. flatMap(segment - > {
374+ if (segment instanceof OracleR2dbcWarning ) {
375+ logWarning(((OracleR2dbcWarning )segment). getMessage());
376+ return emptyPublisher();
377+ }
378+ else if (segment instanceof Result . Message ){
379+ ... handle an error ...
380+ }
381+ else {
382+ ... handle other segment types ...
383+ }
384+ })
385+ ```
386+ Unlike the errors of standard ` Result.Message ` segments, if a warning is not
387+ consumed by ` flatMap ` , then it will be silently discarded when a ` Result ` is
388+ consumed using the ` map ` or ` getRowsUpdated ` methods.
353389
354390### Transactions
355391Oracle R2DBC uses READ COMMITTED as the default transaction isolation level.
@@ -488,12 +524,13 @@ for the out parameters is emitted last, after the `Result` for each cursor.
488524Oracle R2DBC supports type mappings between Java and SQL for non-standard data
489525types of Oracle Database.
490526
491- | Oracle SQL Type | Java Type |
492- | ---------------------------------------------------------------------------------------------------------------------------------------------------------| -----------|
493- | [ JSON] ( https://docs.oracle.com/en/database/oracle/oracle-database/21/sqlrf/Data-Types.html#GUID-E441F541-BA31-4E8C-B7B4-D2FB8C42D0DF ) | ` javax.json.JsonObject ` or ` oracle.sql.json.OracleJsonObject ` |
494- | [ DATE] ( https://docs.oracle.com/en/database/oracle/oracle-database/21/sqlrf/Data-Types.html#GUID-5405B652-C30E-4F4F-9D33-9A4CB2110F1B ) | ` java.time.LocalDateTime ` |
495- | [ INTERVAL DAY TO SECOND] ( https://docs.oracle.com/en/database/oracle/oracle-database/21/sqlrf/Data-Types.html#GUID-B03DD036-66F8-4BD3-AF26-6D4433EBEC1C ) | ` java.time.Duration ` |
496- | [ INTERVAL YEAR TO MONTH] ( https://docs.oracle.com/en/database/oracle/oracle-database/21/sqlrf/Data-Types.html#GUID-ED59E1B3-BA8D-4711-B5C8-B0199C676A95 ) | ` java.time.Period ` |
527+ | Oracle SQL Type | Java Type |
528+ | ---------------------------------------------------------------------------------------------------------------------------------------------------------| ---------------------------------------------------------------|
529+ | [ JSON] ( https://docs.oracle.com/en/database/oracle/oracle-database/21/sqlrf/Data-Types.html#GUID-E441F541-BA31-4E8C-B7B4-D2FB8C42D0DF ) | ` javax.json.JsonObject ` or ` oracle.sql.json.OracleJsonObject ` |
530+ | [ DATE] ( https://docs.oracle.com/en/database/oracle/oracle-database/21/sqlrf/Data-Types.html#GUID-5405B652-C30E-4F4F-9D33-9A4CB2110F1B ) | ` java.time.LocalDateTime ` |
531+ | [ INTERVAL DAY TO SECOND] ( https://docs.oracle.com/en/database/oracle/oracle-database/21/sqlrf/Data-Types.html#GUID-B03DD036-66F8-4BD3-AF26-6D4433EBEC1C ) | ` java.time.Duration ` |
532+ | [ INTERVAL YEAR TO MONTH] ( https://docs.oracle.com/en/database/oracle/oracle-database/21/sqlrf/Data-Types.html#GUID-ED59E1B3-BA8D-4711-B5C8-B0199C676A95 ) | ` java.time.Period ` |
533+ | [ SYS_REFCURSOR] ( https://docs.oracle.com/en/database/oracle/oracle-database/21/lnpls/static-sql.html#GUID-470A7A99-888A-46C2-BDAF-D4710E650F27 ) | ` io.r2dbc.spi.Result ` |
497534> Unlike the standard SQL type named "DATE", the Oracle Database type named
498535> "DATE" stores values for year, month, day, hour, minute, and second. The
499536> standard SQL type only stores year, month, and day. LocalDateTime objects are able
@@ -533,6 +570,35 @@ prefetched entirely, a smaller prefetch size can be configured using the
533570option, and the LOB can be consumed as a stream. By mapping LOB columns to
534571` Blob ` or ` Clob ` objects, the content can be consumed as a reactive stream.
535572
573+ ### REF Cursors
574+ Use the ` oracle.r2dbc.OracleR2dbcTypes.REF_CURSOR ` type to bind ` SYS_REFCURSOR ` out
575+ parameters:
576+ ``` java
577+ Publisher<Result > executeProcedure(Connection connection) {
578+ connection. createStatement(
579+ " BEGIN example_procedure(:cursor_parameter); END;" )
580+ .bind(" cursor_parameter" , Parameters . out(OracleR2dbcTypes . REF_CURSOR ))
581+ .execute()
582+ }
583+ ```
584+ A ` SYS_REFCURSOR ` out parameter can be mapped to an ` io.r2dbc.spi.Result ` :
585+ ``` java
586+ Publisher<Result > mapOutParametersResult(Result outParametersResult) {
587+ return outParametersResult. map(outParameters - >
588+ outParameters. get(" cursor_parameter" , Result . class));
589+ }
590+ ```
591+ The rows of a ` SYS_REFCURSOR ` may be consumed from the ` Result ` it is
592+ mapped to:
593+ ``` java
594+ Publisher<ExampleObject > mapRefCursorRows(Result refCursorResult) {
595+ return refCursorResult. map(row - >
596+ new ExampleObject (
597+ row. get(" id_column" , Long . class),
598+ row. get(" value_column" , String . class)));
599+ }
600+ ```
601+
536602## Secure Programming Guidelines
537603The following security related guidelines should be adhered to when programming
538604with the Oracle R2DBC Driver.
0 commit comments