Skip to content

Commit f1d2cbb

Browse files
camelCase option name and consistent sample config name
1 parent 6bc0839 commit f1d2cbb

File tree

8 files changed

+30
-33
lines changed

8 files changed

+30
-33
lines changed

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -157,11 +157,11 @@ Options. For Options having any of the following names, a CharSequence value may
157157
- [oracle.net.ssl_context_protocol](https://docs.oracle.com/en/database/oracle/oracle-database/21/jajdb/oracle/jdbc/OracleConnection.html?is-external=true#CONNECTION_PROPERTY_SSL_CONTEXT_PROTOCOL)
158158
- [oracle.jdbc.fanEnabled](https://docs.oracle.com/en/database/oracle/oracle-database/21/jajdb/oracle/jdbc/OracleConnection.html?is-external=true#CONNECTION_PROPERTY_FAN_ENABLED)
159159
- [oracle.jdbc.implicitStatementCacheSize](https://docs.oracle.com/en/database/oracle/oracle-database/21/jajdb/oracle/jdbc/OracleConnection.html?is-external=true#CONNECTION_PROPERTY_IMPLICIT_STATEMENT_CACHE_SIZE)
160-
- Oracle Net Descriptors of the form ```(DESCRIPTION=...)``` may be specified as an io.r2dbc.spi.Option having the name `oracle-net-descriptor`.
161-
- If `oracle-net-descriptor` is specified, then it is invalid to specify any other options that might conflict with information in the descriptor, such as: `HOST`, `PORT`, `DATABASE`, and `SSL`.
162-
- The `oracle-net-descriptor` option may appear in the query section of an R2DBC URL: `r2dbc:oracle://?oracle-net-descriptor=(DESCRIPTION=...)`
163-
- The `oracle-net-descriptor` option may be provided programatically: `ConnectionFactoryOptions.builder().option(Option.valueOf("oracle-net-descriptor"), "(DESCRIPTION=...)")`
164-
- The `oracle-net-descriptor` option may be set as the alias of a descriptor in a tnsnames.ora file. The directory of tnsnames.ora may be set using an io.r2dbc.spi.Option having the name `TNS_ADMIN`: `r2dbc:oracle://?oracle-net-descriptor=myAlias&TNS_ADMIN=/path/to/tnsnames/`
160+
- Oracle Net Descriptors of the form ```(DESCRIPTION=...)``` may be specified as an io.r2dbc.spi.Option having the name `oracleNetDescriptor`.
161+
- If `oracleNetDescriptor` is specified, then it is invalid to specify any other options that might conflict with information in the descriptor, such as: `HOST`, `PORT`, `DATABASE`, and `SSL`.
162+
- The `oracleNetDescriptor` option may appear in the query section of an R2DBC URL: `r2dbc:oracle://?oracleNetDescriptor=(DESCRIPTION=...)`
163+
- The `oracleNetDescriptor` option may be provided programatically: `ConnectionFactoryOptions.builder().option(Option.valueOf("oracleNetDescriptor"), "(DESCRIPTION=...)")`
164+
- The `oracleNetDescriptor` option may be set as the alias of a descriptor in a tnsnames.ora file. The directory of tnsnames.ora may be set using an io.r2dbc.spi.Option having the name `TNS_ADMIN`: `r2dbc:oracle://?oracleNetDescriptor=myAlias&TNS_ADMIN=/path/to/tnsnames/`
165165

166166

167167
### Thread Safety and Parallel Execution

sample/example-config.properties

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
1-
# Values in this properties file configure how sample code connects to a
2-
# database.
3-
4-
# This file contains example values. Create a copy named config.properties in
1+
# Values in this properties file configure how sample code connects to a # database. # This file contains example values. Create a copy named config.properties in
52
# /sample and change the example values to actual values for your test database.
63

74
# Host name of a test database
@@ -11,7 +8,7 @@ HOST=db.host.example.com
118
PORT=1521
129

1310
# Service name of a test database
14-
SERVICE_NAME=db.service.name
11+
DATABASE=db.service.name
1512

1613
# User name authenticated by a test database
1714
USER=db_user

sample/src/main/java/oracle/r2dbc/samples/DatabaseConfig.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ public class DatabaseConfig {
6161
static final int PORT = Integer.parseInt(CONFIG.getProperty("PORT"));
6262

6363
/** Service name of an Oracle Database */
64-
static final String SERVICE_NAME = CONFIG.getProperty("SERVICE_NAME");
64+
static final String SERVICE_NAME = CONFIG.getProperty("DATABASE");
6565

6666
/** User name that connects to an Oracle Database */
6767
static final String USER = CONFIG.getProperty("USER");

sample/src/main/java/oracle/r2dbc/samples/DescriptorURL.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ public class DescriptorURL {
5555

5656
public static void main(String[] args) {
5757
// A descriptor may appear in the query section of an R2DBC URL:
58-
String r2dbcUrl = "r2dbc:oracle://?oracle-net-descriptor="+DESCRIPTOR;
58+
String r2dbcUrl = "r2dbc:oracle://?oracleNetDescriptor="+DESCRIPTOR;
5959
Mono.from(ConnectionFactories.get(ConnectionFactoryOptions.parse(r2dbcUrl)
6060
.mutate()
6161
.option(ConnectionFactoryOptions.USER, USER)
@@ -75,7 +75,7 @@ public static void main(String[] args) {
7575
// A descriptor may also be specified as an Option
7676
Mono.from(ConnectionFactories.get(ConnectionFactoryOptions.builder()
7777
.option(ConnectionFactoryOptions.DRIVER, "oracle")
78-
.option(Option.valueOf("oracle-net-descriptor"), DESCRIPTOR)
78+
.option(Option.valueOf("oracleNetDescriptor"), DESCRIPTOR)
7979
.option(ConnectionFactoryOptions.USER, USER)
8080
.option(ConnectionFactoryOptions.PASSWORD, PASSWORD)
8181
.build())

src/main/java/oracle/r2dbc/impl/OracleConnectionFactoryImpl.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ final class OracleConnectionFactoryImpl implements ConnectionFactory {
142142
* @throws IllegalStateException If the value of a required option is not
143143
* specified.
144144
*
145-
* @throws IllegalArgumentException If the {@code oracle-net-descriptor}
145+
* @throws IllegalArgumentException If the {@code oracleNetDescriptor}
146146
* {@code Option} is provided with any other options that might have
147147
* conflicting values, such as {@link ConnectionFactoryOptions#HOST}.
148148
*/
@@ -193,4 +193,4 @@ public Publisher<Connection> create() {
193193
public ConnectionFactoryMetadata getMetadata() {
194194
return () -> "Oracle Database";
195195
}
196-
}
196+
}

src/main/java/oracle/r2dbc/impl/OracleConnectionFactoryProviderImpl.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ public OracleConnectionFactoryProviderImpl() { }
8888
* @throws IllegalStateException If any option required by
8989
* {@link OracleConnectionFactoryImpl} is not specified by {@code options}.
9090
*
91-
* @throws IllegalArgumentException If the {@code oracle-net-descriptor}
91+
* @throws IllegalArgumentException If the {@code oracleNetDescriptor}
9292
* {@code Option} is provided with any other options that might have
9393
* conflicting values, such as {@link ConnectionFactoryOptions#HOST}.
9494
*/
@@ -124,4 +124,4 @@ public String getDriver() {
124124
return DRIVER_IDENTIFIER;
125125
}
126126

127-
}
127+
}

src/main/java/oracle/r2dbc/impl/OracleReactiveJdbcAdapter.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ final class OracleReactiveJdbcAdapter implements ReactiveJdbcAdapter {
200200
* of the form "(DESCRIPTION=...)"
201201
*/
202202
private static final Option<CharSequence> DESCRIPTOR =
203-
Option.valueOf("oracle-net-descriptor");
203+
Option.valueOf("oracleNetDescriptor");
204204

205205
/**
206206
* Java object types that are supported by
@@ -421,7 +421,7 @@ static OracleReactiveJdbcAdapter getInstance() {
421421
* this way, the Oracle JDBC Driver uses the default character set of the
422422
* database, which may not support Unicode characters.
423423
*
424-
* @throws IllegalArgumentException If the {@code oracle-net-descriptor}
424+
* @throws IllegalArgumentException If the {@code oracleNetDescriptor}
425425
* {@code Option} is provided with any other options that might have
426426
* conflicting values, such as {@link ConnectionFactoryOptions#HOST}.
427427
*/
@@ -446,7 +446,7 @@ public DataSource createDataSource(ConnectionFactoryOptions options) {
446446
* {@link #createDataSource(ConnectionFactoryOptions)}
447447
* @param options R2DBC options. Not null.
448448
* @return An Oracle JDBC URL composed from R2DBC options
449-
* @throws IllegalArgumentException If the {@code oracle-net-descriptor}
449+
* @throws IllegalArgumentException If the {@code oracleNetDescriptor}
450450
* {@code Option} is provided with any other options that might have
451451
* conflicting values, such as {@link ConnectionFactoryOptions#HOST}.
452452
*/
@@ -490,7 +490,7 @@ private static void validateDescriptorOptions(
490490
// Ignore options having a value that can be represented as a
491491
// zero-length String; It may be necessary to include a zero-length
492492
// host name in an R2DBC URL:
493-
// r2dbc:oracle://user:password@?oracle-net-descriptor=...
493+
// r2dbc:oracle://user:password@?oracleNetDescriptor=...
494494
! options.getValue(option).toString().isEmpty())
495495
.toArray(Option[]::new);
496496

src/test/java/oracle/r2dbc/impl/OracleReactiveJdbcAdapterTest.java

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -200,13 +200,13 @@ public void testTnsAdmin() throws IOException {
200200
// Expect to connect with the descriptor in the R2DBC URL
201201
awaitNone(awaitOne(
202202
ConnectionFactories.get(String.format(
203-
"r2dbc:oracle://%s:%s@?oracle-net-descriptor=%s",
203+
"r2dbc:oracle://%s:%s@?oracleNetDescriptor=%s",
204204
user(), password(), descriptor))
205205
.create())
206206
.close());
207207
awaitNone(awaitOne(
208208
ConnectionFactories.get(ConnectionFactoryOptions.parse(String.format(
209-
"r2dbc:oracle://@?oracle-net-descriptor=%s", descriptor))
209+
"r2dbc:oracle://@?oracleNetDescriptor=%s", descriptor))
210210
.mutate()
211211
.option(USER, user())
212212
.option(PASSWORD, password())
@@ -218,13 +218,13 @@ public void testTnsAdmin() throws IOException {
218218
// the file path and an alias
219219
awaitNone(awaitOne(
220220
ConnectionFactories.get(String.format(
221-
"r2dbc:oracle://%s:%s@?oracle-net-descriptor=%s&TNS_ADMIN=%s",
221+
"r2dbc:oracle://%s:%s@?oracleNetDescriptor=%s&TNS_ADMIN=%s",
222222
user(), password(), "test_alias", System.getProperty("user.dir")))
223223
.create())
224224
.close());
225225
awaitNone(awaitOne(
226226
ConnectionFactories.get(ConnectionFactoryOptions.parse(String.format(
227-
"r2dbc:oracle://@?oracle-net-descriptor=%s&TNS_ADMIN=%s",
227+
"r2dbc:oracle://@?oracleNetDescriptor=%s&TNS_ADMIN=%s",
228228
"test_alias", System.getProperty("user.dir")))
229229
.mutate()
230230
.option(USER, user())
@@ -237,25 +237,25 @@ public void testTnsAdmin() throws IOException {
237237
// are provided with a descriptor
238238
assertThrows(IllegalArgumentException.class, () ->
239239
ConnectionFactories.get(
240-
"r2dbc:oracle://"+host()+"?oracle-net-descriptor="+descriptor));
240+
"r2dbc:oracle://"+host()+"?oracleNetDescriptor="+descriptor));
241241
assertThrows(IllegalArgumentException.class, () ->
242242
ConnectionFactories.get("r2dbc:oracle://"
243-
+host()+":"+port()+"?oracle-net-descriptor="+descriptor));
243+
+host()+":"+port()+"?oracleNetDescriptor="+descriptor));
244244
assertThrows(IllegalArgumentException.class, () ->
245245
ConnectionFactories.get("r2dbc:oracle://"+host()+":"+port()+"/"
246-
+serviceName()+"?oracle-net-descriptor="+descriptor));
246+
+serviceName()+"?oracleNetDescriptor="+descriptor));
247247
assertThrows(IllegalArgumentException.class, () ->
248248
ConnectionFactories.get("r2dbc:oracle://"+host()+"/"
249-
+serviceName()+"?oracle-net-descriptor="+descriptor));
249+
+serviceName()+"?oracleNetDescriptor="+descriptor));
250250
assertThrows(IllegalArgumentException.class, () ->
251251
ConnectionFactories.get("r2dbc:oracle:///"
252-
+serviceName()+"?oracle-net-descriptor="+descriptor));
252+
+serviceName()+"?oracleNetDescriptor="+descriptor));
253253
assertThrows(IllegalArgumentException.class, () ->
254254
ConnectionFactories.get("r2dbcs:oracle://" + // r2dbcs is SSL=true
255-
"?oracle-net-descriptor="+descriptor));
255+
"?oracleNetDescriptor="+descriptor));
256256
assertThrows(IllegalArgumentException.class, () ->
257257
ConnectionFactories.get(
258-
"r2dbc:oracle://?oracle-net-descriptor="+descriptor+"&ssl=true"));
258+
"r2dbc:oracle://?oracleNetDescriptor="+descriptor+"&ssl=true"));
259259

260260
// Create an ojdbc.properties file containing the user name
261261
Files.writeString(Path.of("ojdbc.properties"),
@@ -267,7 +267,7 @@ public void testTnsAdmin() throws IOException {
267267
// specifies a user, and a standard option specifies the password.
268268
awaitNone(awaitOne(
269269
ConnectionFactories.get(ConnectionFactoryOptions.parse(String.format(
270-
"r2dbc:oracle://?oracle-net-descriptor=%s&TNS_ADMIN=%s",
270+
"r2dbc:oracle://?oracleNetDescriptor=%s&TNS_ADMIN=%s",
271271
"test_alias", System.getProperty("user.dir")))
272272
.mutate()
273273
.option(PASSWORD, password())

0 commit comments

Comments
 (0)