@@ -2361,8 +2361,8 @@ Allows a connection to be established directly to a database shard. See
2361
2361
[Connecting to Sharded Databases](#sharding).
2362
2362
2363
2363
Array values may be of String type (mapping to VARCHAR2 sharding keys), Number
2364
- (NUMBER), or Buffer (RAW). Multiple types may be used in the array. Sharding
2365
- keys of DATE and TIMESTAMP types are not supported.
2364
+ (NUMBER), Date (DATE), or Buffer (RAW). Multiple types may be used in the
2365
+ array. Sharding keys TIMESTAMP type are not supported.
2366
2366
2367
2367
This property was added in node-oracledb 4.1.
2368
2368
@@ -2387,8 +2387,8 @@ Allows a connection to be established directly to a database shard. See
2387
2387
[Connecting to Sharded Databases](#sharding).
2388
2388
2389
2389
Array values may be of String type (mapping to VARCHAR2 sharding keys), Number
2390
- (NUMBER), or Buffer (RAW). Multiple types may be used in the array. Sharding
2391
- keys of DATE and TIMESTAMP types are not supported.
2390
+ (NUMBER), Date (DATE), or Buffer (RAW). Multiple types may be used in the
2391
+ array. Sharding keys TIMESTAMP type are not supported.
2392
2392
2393
2393
This property was added in node-oracledb 4.1.
2394
2394
@@ -8758,8 +8758,8 @@ key or super shard key is used.
8758
8758
8759
8759
The sharding and super sharding key properties are arrays of values. Array key
8760
8760
values may be of type String (mapping to VARCHAR2 sharding keys), Number
8761
- (NUMBER), or Buffer (RAW). Multiple types may be used in each array. Sharding
8762
- keys of DATE and TIMESTAMP types are not supported by node-oracledb.
8761
+ (NUMBER), Date (DATE), or Buffer (RAW). Multiple types may be used in each
8762
+ array. Sharding keys of TIMESTAMP type are not supported by node-oracledb.
8763
8763
8764
8764
For example, if sharding had been configured on a single column like:
8765
8765
@@ -8818,7 +8818,36 @@ const connection = await oracledb.getConnection(
8818
8818
});
8819
8819
```
8820
8820
8821
- To connect to shards when the sharding key is a RAW column like:
8821
+ When the sharding key is a DATE column like:
8822
+
8823
+ ```sql
8824
+ CREATE SHARDED TABLE customers (
8825
+ cust_id NUMBER,
8826
+ cust_name VARCHAR2(30),
8827
+ class VARCHAR2(10) NOT NULL,
8828
+ signup_date DATE,
8829
+ cust_code RAW(20),
8830
+ CONSTRAINT signup_date_pk PRIMARY KEY(signup_date))
8831
+ PARTITION BY CONSISTENT HASH (signup_date)
8832
+ PARTITIONS AUTO TABLESPACE SET ts1;
8833
+ ```
8834
+
8835
+ then direct connection to a shard needs a Date key that is in the session time
8836
+ zone. For example if the session time zone is set to UTC (see [Fetching Dates
8837
+ and Timestamps](#datehandling)) then Dates must also be in UTC:
8838
+
8839
+ ```javascript
8840
+ key = new Date ("2019-11-30Z"); // when session time zone is UTC
8841
+ const connection = await oracledb.getConnection(
8842
+ {
8843
+ user : "hr",
8844
+ password : mypw, // mypw contains the hr schema password
8845
+ connectString : "localhost/orclpdb1",
8846
+ shardingkey : [key]
8847
+ });
8848
+ ```
8849
+
8850
+ When the sharding key is a RAW column like:
8822
8851
8823
8852
```sql
8824
8853
CREATE SHARDED TABLE customers (
@@ -9343,6 +9372,16 @@ $ export ORA_SDTZ='UTC'
9343
9372
$ node myapp.js
9344
9373
```
9345
9374
9375
+ If this variable is set in the application, it must be set before the first
9376
+ connection is established:
9377
+
9378
+ ```javascript
9379
+ process.env.ORA_SDTZ = 'UTC';
9380
+
9381
+ const oracledb = require('oracledb');
9382
+ const connection = await oracledb.getConnection(. . . );
9383
+ ```
9384
+
9346
9385
The session time zone can also be changed at runtime for each
9347
9386
connection by executing:
9348
9387
0 commit comments