Skip to content

Commit 5283c3b

Browse files
committed
Work on Windows install doc with some help from @bchr02
1 parent 449aacd commit 5283c3b

File tree

1 file changed

+80
-40
lines changed

1 file changed

+80
-40
lines changed

INSTALL.md

Lines changed: 80 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Installing node-oracledb
1+
# Installing node-oracledb
22

33
*Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.*
44

@@ -23,7 +23,8 @@ limitations under the License.
2323
4. [Node-oracledb Installation on Linux with a Local Database](#instoh)
2424
5. [Node-oracledb Installation on OS X with Instant Client](#instosx)
2525
6. [Node-oracledb Installation on Windows](#instwin)
26-
7. [Advanced Installation on Linux](#linuxadv)
26+
7. [Copying node-oracledb Binaries on Windows](#winbins)
27+
8. [Advanced Installation on Linux](#linuxadv)
2728

2829
## <a name="overview"></a> 1. Overview
2930

@@ -39,18 +40,20 @@ but these architectures have not been fully tested.
3940

4041
### Prerequisites
4142

42-
This installation requires Oracle 11.2 or 12.1 client libraries.
43+
Installation requires Oracle 11.2 or 12.1 client libraries.
4344
These are included in Oracle Instant Client RPMs or ZIPs, a full
4445
Oracle Client, or a database on the same machine. Oracle's standard
45-
client-server network compatibility applies, which enables connection
46-
to databases with different versions from the Oracle client library
47-
version.
46+
client-server network compatibility applies. For example, with Oracle
47+
client 12.1 you can connect to Oracle Database 10.2 or greater. Use
48+
Oracle client 11.2 if you need to connect to Oracle Database 9.2.
4849

49-
Gcc is needed on Linux. On OS X, install Xcode. Python 2.7 is needed
50-
for node-gyp. If another version of Python occurs first in your
51-
binary path then, when you install node-oracledb, use the `--python`
52-
option to indicate the correct version. For example `npm install
53-
--python=/whereever/python-2.7/bin/python oracledb`.
50+
A compiler is needed. Use Visual Studio on Windows, gcc on Linux or
51+
Xcode on OS X.
52+
53+
Python 2.7 is needed by node-gyp. If another version of Python occurs
54+
first in your binary path then, when you install node-oracledb, use
55+
the `--python` option to indicate the correct version. For example:
56+
`npm install --python=/whereever/python-2.7/bin/python oracledb`.
5457

5558
### Which Instructions to Follow
5659

@@ -135,7 +138,7 @@ setting the install-time variables `OCI_LIB_DIR` and `OCI_INC_DIR` to
135138
the appropriate directories.
136139

137140
If you have other Oracle software installed on the same machine, and
138-
the runtime linker is configured to find this other software via
141+
the run time linker is configured to find this other software via
139142
`LD_LIBRARY_PATH` or `ldconfig`, then update the environment to use
140143
the Instant Client RPM libraries, for example
141144
`/usr/lib/oracle/12.1/client64/lib`.
@@ -472,18 +475,16 @@ see
472475

473476
Install a C/C++ build environment such as Microsoft Visual
474477
Studio 2012. Compilers supported by Oracle libraries are found in
475-
Oracle documentation for each version, for example
478+
[Oracle documentation](https://docs.oracle.com/en/database/) for each version, for example
476479
[Oracle Database Client Quick Installation Guide 12c Release 1 (12.1) for Microsoft Windows x64 (64-Bit)](https://docs.oracle.com/database/121/NXCQI/toc.htm#NXCQI108).
477-
You will also need the matching Visual C++ Redistributable for Visual
478-
Studio.
479480

480481
Install the Python 2.7 MSI from
481482
[www.python.org](https://www.python.org/downloads). Select the
482483
customization option to "Add python.exe to Path".
483484

484485
If you use a 32-bit Node.js, make sure to use a 32-bit Oracle client
485486
during build and run time. Otherwise use a 64-bit Node.js with a
486-
64-bit Oracle client.
487+
64-bit Oracle client. The instructions below use a 64-bit stack.
487488

488489
### 6.2 Install Node.js
489490

@@ -493,56 +494,74 @@ add the Node and npm directories to the path is selected.
493494

494495
### 6.3 Install the free Oracle Instant Client ZIPs
495496

496-
Skip this step if you already have Oracle Database or the full Oracle client on your machine.
497+
Building and running node-oracledb needs appropriate Oracle client
498+
libraries installed first. These libraries:
499+
500+
- are included in (i) Oracle database, or (ii) in the full Oracle client, or (iii) in Oracle Instant Client. You need one of these.
501+
- must be version 11.2 or greater
502+
- must match the Node.js 32 or 64-bit architecture
497503

498-
Download the free **Basic** and **SDK** ZIP files from
504+
If you need appropriate Oracle client libraries, then download the
505+
free Instant Client **Basic** and **SDK** ZIP files from
499506
[Oracle Technology Network](http://www.oracle.com/technetwork/topics/winx64soft-089540.html).
500507

501508
Extract `instantclient_basic-windows.x64-12.1.0.2.0.zip` and
502509
`instantclient_sdk-windows.x64-12.1.0.2.0.zip` to the same directory.
503510

504-
Optionally rename the resulting directory to `C:\oracle\instantclient`
511+
Optionally rename the resulting Instant Client directory to the
512+
default location used by the node-oracledb installer:
513+
514+
```
515+
ren C:\instantclient_12_1 C:\oracle\instantclient
516+
```
505517

506-
Add the directory to PATH. For example on Windows 7, update PATH in
518+
Add the directory to `PATH`. For example on Windows 7, update `PATH` in
507519
Control Panel -> System -> Advanced System Settings -> Advanced ->
508-
Environment Variables -> System variables. If you have multiple
509-
versions of Oracle libraries installed, make sure to put the desired
510-
version first in the path.
520+
Environment Variables -> System variables.
521+
522+
If you have multiple versions of Oracle libraries installed, make sure
523+
the desired version occurs first in the path.
511524

512525
### 6.4 Install the add-on
513526

514527
Start Visual Studio and open a Developer Command Prompt within it.
515-
(If you instead decide to use a command shell outside Visual Studio, then
516-
run `vcvars64.bat` for 64-bit builds or `vcvars.bat` for 32-bit builds).
517528

518529
Use `set PATH` in the shell to confirm the Python, Node.js and Oracle
519-
directories are correctly set. If they are not, then set PATH
530+
directories are correctly set. If they are not, then set `PATH`
520531
manually in the shell, or set it in the System Properties panel and
521532
restart the command shell.
522533

523-
Tell the installer where to locate the Instant Client:
534+
Make sure the Microsoft Visual Studio environment variables are set
535+
appropriately. Use `set PATH` and verify it contains your Visual
536+
Studio paths. If they are not set, use vcvars64.bat (or vcvars.bat if
537+
you building with 32-bit binaries) to set the environment.
538+
Alternatively you can open the 'Developer Command Prompt for Visual
539+
Studio' which has environment variables already configured.
524540

525-
```
526-
set OCI_LIB_DIR=C:\wherever\instantclient_12_1\sdk\lib\msvc
527-
set OCI_INC_DIR=C:\wherever\instantclient_12_1\sdk\include
528-
```
541+
Tell the installer where to locate the Oracle client libraries and
542+
header files by setting the `OCI_LIB_DIR` and `OCI_INC_DIR` variables.
529543

530-
These variables are only needed during installation.
544+
These variables are only needed during installation, not at run time.
531545

532-
If Instant Client is in `C:\oracle\instantclient` (this should
533-
contain, amongst others, the file `C:\oracle\instantclient\oci.dll`
534-
and directory `C:\oracle\instantclient\sdk`), then these variables are
535-
not needed.
546+
For Instant Client use:
547+
548+
```
549+
set OCI_LIB_DIR=C:\oracle\instantclient\sdk\lib\msvc
550+
set OCI_INC_DIR=C:\oracle\instantclient\sdk\include
551+
```
536552

537553
If you are installing with a local database or the full Oracle client,
538-
you must set the variables, for example using:
554+
then locate the Oracle directory and set the node-oracle installer
555+
variables similar to:
539556

540557
```
541558
set OCI_LIB_DIR=C:\oracle\product\12.1.0\dbhome_1\oci\lib\msvc
542559
set OCI_INC_DIR=C:\oracle\product\12.1.0\dbhome_1\oci\include
543560
```
544561

545-
If you are behind a firewall, you may need to set your proxy, for
562+
Also make sure that `PATH` contains `C:\oracle\product\12.1.0\dbhome_1\bin`.
563+
564+
If you are behind a firewall you may need to set your proxy, for
546565
example:
547566

548567
```
@@ -573,12 +592,33 @@ module.exports = {
573592
```
574593

575594
Run one of the examples:
576-
595+
577596
```
578597
node select1.js
579598
```
580599

581-
## <a name="linuxadv"></a> 7. Advanced Installation on Linux
600+
## <a name="winbins"></a> 7. Copying node-oracledb Binaries on Windows
601+
602+
Node-oracledb binaries can be copied between compatible Windows systems.
603+
604+
Both computers must have the same version and architecture of Node.js.
605+
606+
Oracle client libraries of the same architecture and the same, or
607+
higher, version used for building node-oracledb should be in the
608+
destination computer's `PATH`.
609+
610+
After node-oracle has been built on the source computer, copy the
611+
`node_modules/oracledb` directory to the destination computer's
612+
`node_module` directory.
613+
614+
If node-oracledb was compiled using Visual Studio 2010 or higher, you
615+
will need to have the Visual C++ 2010 Redistributable installed on the
616+
destination computer. For older compilers, you will need the matching
617+
C++ redistributable version. For example, if you compiled with Visual
618+
Studio 2008, you will need the Visual Studio 2008 C++ Redistributable
619+
installed.
620+
621+
## <a name="linuxadv"></a> 8. Advanced Installation on Linux
582622

583623
### <a name="linuxinstsearchpath"></a> Oracle Client Location Heuristic on Linux
584624

0 commit comments

Comments
 (0)