Skip to content

Commit dad8fe5

Browse files
committed
Backslash love (Issue #1268)
1 parent b90a0f7 commit dad8fe5

File tree

2 files changed

+19
-10
lines changed

2 files changed

+19
-10
lines changed

INSTALL.md

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -868,14 +868,16 @@ Client libraries are, see [Initializing Node-oracledb][17]:
868868
```javascript
869869
const oracledb = require('oracledb');
870870
try {
871-
oracledb.initOracleClient({libDir: 'C:\oracle\instantclient_19_6'});
871+
oracledb.initOracleClient({libDir: 'C:\\oracle\\instantclient_19_6'});
872872
} catch (err) {
873873
console.error('Whoops!');
874874
console.error(err);
875875
process.exit(1);
876876
}
877877
```
878878
879+
If you use backslashes in the `libDir` string, you will need to double them.
880+
879881
- Alternatively, copy the Oracle Instant Client libraries to the
880882
`node_modules/oracledb/build/Release` directory where the `oracledb*.node`
881883
binary is.
@@ -913,17 +915,19 @@ documentation.
913915
914916
If you use optional Oracle configuration files such as `tnsnames.ora`,
915917
`sqlnet.ora` or `oraaccess.xml` with Instant Client, then put the files in an
916-
accessible directory, for example in `C:\oracle\your_config_dir`. Then use
917-
[`oracledb.initOracleClient()`][64] in your application:
918+
accessible directory. For example if they are in `C:\oracle\your_config_dir`
919+
then use [`oracledb.initOracleClient()`][64] in your application:
918920
919921
```javascript
920922
const oracledb = require('oracledb');
921-
oracledb.initOracleClient({configDir: 'C:\oracle\your_config_dir'});
923+
oracledb.initOracleClient({configDir: 'C:\\oracle\\your_config_dir'});
922924
```
923925

926+
If you use backslashes in the `configDir` string, you will need to double them.
927+
924928
Or you can set the environment variable `TNS_ADMIN` to that directory name.
925929

926-
Another alternative is to put the files in the `network/admin` subdirectory of
930+
Another alternative is to put the files in the `network\admin` subdirectory of
927931
Instant Client, for example in `C:\oracle\instantclient_19_6\network\admin`.
928932
This is the default Oracle configuration directory for executables linked with
929933
this Instant Client.
@@ -1025,8 +1029,9 @@ Optional Oracle client configuration files such as [`tnsnames.ora`][15],
10251029
`$ORACLE_HOME\network\admin`.
10261030

10271031
Alternatively, if you use Oracle client configuration files, they can be put in
1028-
another, accessible directory. Then use `oracledb.initOracleClient({configDir:
1029-
'C:\oracle\your_config_dir'});` in your application or set the environment
1032+
another, accessible directory. For example in `C:\oracle\your_config_dir`.
1033+
Then use `oracledb.initOracleClient({configDir:
1034+
'C:\\oracle\\your_config_dir'});` in your application or set the environment
10301035
variable `TNS_ADMIN` to that directory name.
10311036

10321037
##### 3.4.2.5 Run an example program

doc/api.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2709,10 +2709,10 @@ The options parameter and option attributes are optional. If an attribute is se
27092709

27102710
Attribute | Description
27112711
------------------- |-----------------------------
2712-
`configDir` | This specifies the directory in which the [Optional Oracle Net Configuration](#tnsadmin) and [Optional Oracle Client Configuration](#oraaccess) files reside. It is equivalent to setting the Oracle environment variable `TNS_ADMIN` to this value. Any value in that environment variable prior to the call to `oracledb.initOracleClient()` is ignored. If this attribute is not set, Oracle's default configuration file [search heuristics](#tnsadmin) are used.
2712+
`configDir` | This specifies the directory in which the [Optional Oracle Net Configuration](#tnsadmin) and [Optional Oracle Client Configuration](#oraaccess) files reside. It is equivalent to setting the Oracle environment variable `TNS_ADMIN` to this value. Any value in that environment variable prior to the call to `oracledb.initOracleClient()` is ignored. On Windows, remember to double each blackslash used as a directory separator. If `configDir` is not set, Oracle's default configuration file [search heuristics](#tnsadmin) are used.
27132713
`driverName` | This specifies the driver name value shown in database views, such as `V$SESSION_CONNECT_INFO`. It can be used by applications to identify themselves for tracing and monitoring purposes. The convention is to separate the product name from the product version by a colon and single space characters. If this attribute is not specified, the value "node-oracledb : *version*" is used. See [Other Node-oracledb Initialization](#otherinit).
27142714
`errorUrl` | This specifies the URL that is included in the node-oracledb exception message if the Oracle Client libraries cannot be loaded. This allows applications that use node-oracledb to refer users to application-specific installation instructions. If this attribute is not specified, then the [node-oracledb installation instructions][2] URL is used. See [Other Node-oracledb Initialization](#otherinit).
2715-
`libDir` | This specifies the directory containing the Oracle Client libraries. If `libDir` is not specified, the default library search mechanism is used. If your client libraries are in a full Oracle Client or Oracle Database installation, such as Oracle Database "XE" Express Edition, then you must have previously set environment variables like `ORACLE_HOME` before calling `initOracleClient()`. See [Locating the Oracle Client Libraries](#oracleclientloading).
2715+
`libDir` | This specifies the directory containing the Oracle Client libraries. If `libDir` is not specified, the default library search mechanism is used. If your client libraries are in a full Oracle Client or Oracle Database installation, such as Oracle Database "XE" Express Edition, then you must have previously set environment variables like `ORACLE_HOME` before calling `initOracleClient()`. On Windows, remember to double each blackslash used as a directory separator. See [Locating the Oracle Client Libraries](#oracleclientloading).
27162716

27172717

27182718
On Linux, ensure a `libclntsh.so` file exists. On macOS ensure a
@@ -7750,14 +7750,16 @@ use:
77507750
```javascript
77517751
const oracledb = require('oracledb');
77527752
try {
7753-
oracledb.initOracleClient({libDir: 'C:\oracle\instantclient_19_6'});
7753+
oracledb.initOracleClient({libDir: 'C:\\oracle\\instantclient_19_6'});
77547754
} catch (err) {
77557755
console.error('Whoops!');
77567756
console.error(err);
77577757
process.exit(1);
77587758
}
77597759
```
77607760

7761+
If you use backslashes in the `libDir` string, you will need to double them.
7762+
77617763
The `initOracleClient()` function should only be called once.
77627764

77637765
If you set `libDir` on Linux and related platforms, you must still have
@@ -7795,6 +7797,8 @@ const oracledb = require('oracledb');
77957797
oracledb.initOracleClient({configDir: '/etc/my-oracle-config'});
77967798
```
77977799

7800+
(If you use backslashes in the `configDir` string, you will need to double them.)
7801+
77987802
This is equivalent to setting the environment variable [`TNS_ADMIN`][8] to
77997803
`/etc/my-oracle-config`.
78007804

0 commit comments

Comments
 (0)