Skip to content

Commit ffca4ce

Browse files
committed
Preview release of node-oracledb
1 parent c272b66 commit ffca4ce

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+11443
-202
lines changed

.gitignore

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# General Ignores
2+
*~
3+
*.o
4+
\#*#
5+
core
6+
build
7+
8+
# Other Ignores
9+
npm-debug.log
10+
11+
# Oracle Ignores
12+
sqlnet.log
13+
sqlnet.ora
14+
tnsnames.ora
15+
oraaccess.xml

CONTRIBUTING.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Contributing to node-oracledb
2+
3+
*Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.*
4+
5+
Pull requests can be made under
6+
[The Oracle Contributor Agreement](https://www.oracle.com/technetwork/community/oca-486395.html)
7+
(OCA).
8+
9+
We have a list of great things we want to implement. If you have
10+
ideas, get in touch so we don't duplicate efforts.
11+
12+
For pull requests to be accepted into node-oracledb, the bottom of
13+
your commit message must have the following line using your name and
14+
e-mail address as it appears in the OCA Signatories list.
15+
16+
```
17+
Signed-off-by: Your Name <[email protected]>
18+
```
19+
20+
This can be automatically added to pull requests by committing with:
21+
22+
```
23+
git commit --signoff
24+
````
25+
26+
Only pull requests from committers that can be verified as having
27+
signed the OCA can be accepted.

INSTALL.md

Lines changed: 348 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,348 @@
1+
# Installing node-oracledb
2+
3+
*Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.*
4+
5+
You may not use the identified files except in compliance with the Apache
6+
License, Version 2.0 (the "License.")
7+
8+
You may obtain a copy of the License at
9+
http://www.apache.org/licenses/LICENSE-2.0.
10+
11+
Unless required by applicable law or agreed to in writing, software
12+
distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
13+
WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
15+
See the License for the specific language governing permissions and
16+
limitations under the License.
17+
18+
## Contents
19+
20+
1. [Overview](#installation)
21+
2. [Installation with Instant Client RPMs](#instrpm)
22+
3. [Installation with Instant Client ZIP files](#instzip)
23+
4. [Installation with a local database](#instoh)
24+
25+
## <a name="overview"></a> 1. Overview
26+
27+
The steps below create a standalone Node.js installation for testing.
28+
Adjust the steps for your environment.
29+
30+
The node-oracledb 0.2 release has been tested with Node.js 0.10.35 on
31+
64-bit Oracle Linux. The driver can also build in some 32-bit Linux,
32+
Solaris and Mac OS X environments, but these architectures have not
33+
been fully tested. Installation on those platforms is similar to the
34+
steps described in this document.
35+
36+
Node-oracledb is currently only available on GitHub.
37+
38+
### Prerequisites
39+
40+
This installation requires Oracle 11.2 or 12.1 client libraries.
41+
These are included in Oracle Instant Client RPMs or ZIPs, a full
42+
Oracle Client, or a database on the same machine. Oracle's standard
43+
client-server network compatibility applies, which enables connection
44+
to databases with different versions.
45+
46+
Python 2.7 is needed for node-gyp. Gcc is needed on Linux. On OS X,
47+
install Xcode.
48+
49+
### Which Instructions to Follow
50+
51+
Instructions may need to be adjusted for your platform and environment.
52+
53+
54+
I have ... | Follow this ...
55+
----------|-----------------
56+
Linux. My database is on another machine. | [Installation with Instant Client RPMs](#instrpm)
57+
Solaris. My database is on another machine. | [Installation with Instant Client ZIP files](#instzip)
58+
Linux or Solaris, with a database on the same machine. | [Installation with a local database](#instoh)
59+
Linux or Solaris, with the full Oracle client (installed via runInstaller) on the same machine. | [Installation with a local database](#instoh)
60+
Mac OS X. | [Installation with Instant Client ZIP files](#instzip)
61+
Another OS with Oracle 11.2 or 12.1 libraries available | Update binding.gyp and make any code changes required, sign the [OCA](https://www.oracle.com/technetwork/community/oca-486395.html), and submit a pull request with your patch (Windows support is already being worked on).
62+
63+
Node-oracledb can be installed on the pre-built
64+
[*Database App Development VM*](http://www.oracle.com/technetwork/community/developer-vm/index.html#dbapp) for [VirtualBox](https://www.virtualbox.org),
65+
which has Oracle Database 12c pre-installed on Oracle Linux. If you want to install your
66+
own database, installing the free
67+
[Oracle Database 11.2 'XE' Express Edition](http://www.oracle.com/technetwork/database/database-technologies/express-edition/overview/index.html)
68+
is quick and easy. Other database editions may be downloaded
69+
[here](http://www.oracle.com/technetwork/database/enterprise-edition/downloads/index-092322.html). If you want to
70+
install Oracle Linux yourself, it is free from
71+
[here](http://public-yum.oracle.com/).
72+
73+
## <a name="instrpm"></a> 2. Installation with Instant Client RPMs
74+
75+
### 2.1 Clone [this repository](https://github.com/oracle/node-oracledb)
76+
77+
```
78+
git clone https://github.com/oracle/node-oracledb.git
79+
```
80+
81+
### 2.2 Install Node.js
82+
83+
Download the
84+
[Node.js Linux 64-bit binaries](http://nodejs.org/download/) and
85+
extract the file, for example into `$HOME/Desktop`:
86+
87+
```
88+
cd $HOME/Desktop
89+
tar -zxf node-v0.10.35-linux-x64.tar.gz
90+
```
91+
92+
Set the PATH variable to include Node.js:
93+
94+
```
95+
export PATH=$HOME/Desktop/node-v0.10.35-linux-x64/bin:$PATH
96+
```
97+
98+
### 2.3 Install the free Oracle Instant Client RPMs
99+
100+
Download the free 'Basic' and 'SDK' RPMs from [Oracle Technology Network](http://www.oracle.com/technetwork/topics/linuxx86-64soft-092277.html) and
101+
[install them](http://www.oracle.com/technetwork/topics/linuxx86-64soft-092277.html#ic_x64_inst) as the root user:
102+
103+
```
104+
rpm -ivh oracle-instantclient12.1-basic-12.1.0.2.0-1.x86_64.rpm
105+
rpm -ivh oracle-instantclient12.1-devel-12.1.0.2.0-1.x86_64.rpm
106+
```
107+
108+
If you have a [ULN](https://linux.oracle.com) subscription, you can
109+
alternatively use `yum` to install these packages from the appropriate
110+
*Oracle Software for Oracle Linux* channel.
111+
112+
To run applications, you will need to set the link path:
113+
114+
```
115+
export LD_LIBRARY_PATH=/usr/lib/oracle/12.1/client64/lib
116+
```
117+
118+
Alternatively, if there is no other Oracle software on the machine
119+
that will be impacted, permanently add Instant Client to the run-time
120+
link path. Do this by creating a file
121+
`/etc/ld.so.conf.d/oracle-instantclient.conf` that contains the library
122+
location `/usr/lib/oracle/12.1/client64/lib`, and then run `ldconfig`
123+
as the root user.
124+
125+
### 2.4 Install the driver
126+
127+
If you use a version of the RPMs other than 12.1.0.2, you need to
128+
set `OCI_LIB_DIR` and `OCI_INC_DIR` during installation, as shown in
129+
the [ZIP instructions](#instzip).
130+
131+
Run the installer:
132+
133+
```
134+
cd node-oracledb
135+
npm install -g
136+
```
137+
138+
### 2.5 Run an example program
139+
140+
Set `NODE_PATH` to include the newly installed node-oracledb driver:
141+
142+
```
143+
export NODE_PATH=$HOME/Desktop/node-v0.10.35-linux-x64/lib/node_modules
144+
```
145+
146+
Edit `dbconfig.js` in the `examples` directory and set the database
147+
credentials to your environment.
148+
149+
```
150+
module.exports = {
151+
user : "hr",
152+
password : "welcome",
153+
connectString : "localhost/XE"
154+
};
155+
```
156+
157+
Run one of the examples:
158+
159+
```
160+
node examples/select1.js
161+
```
162+
163+
Remember to set `LD_LIBRARY_PATH` or equivalent first.
164+
165+
## <a name="instzip"></a> 3. Installation with Instant Client ZIP files
166+
167+
### 3.1 Clone [this repository](https://github.com/oracle/node-oracledb)
168+
169+
```
170+
git clone https://github.com/oracle/node-oracledb.git
171+
```
172+
173+
### 3.2 Install Node.js
174+
175+
Download the
176+
[Node.js Linux 64-bit binaries](http://nodejs.org/download/) and
177+
extract the file, for example into `$HOME/Desktop`:
178+
179+
```
180+
cd $HOME/Desktop
181+
tar -zxf node-v0.10.35-linux-x64.tar.gz
182+
```
183+
184+
Set your PATH to include Node.js:
185+
186+
```
187+
export PATH=$HOME/Desktop/node-v0.10.35-linux-x64/bin:$PATH
188+
```
189+
190+
### 3.3 Install the free Oracle Instant Client ZIPs
191+
192+
Download the free 'Basic' and 'SDK' ZIPs from
193+
[Oracle Technology Network](http://www.oracle.com/technetwork/topics/linuxx86-64soft-092277.html)
194+
and
195+
[install them](http://www.oracle.com/technetwork/topics/linuxx86-64soft-092277.html#ic_x64_inst):
196+
197+
```
198+
cd /opt/oracle
199+
unzip instantclient-basic-linux.x64-12.1.0.2.0.zip
200+
unzip instantclient-sdk-linux.x64-12.1.0.2.0.zip
201+
cd instantclient_12_1
202+
ln -s libclntsh.so.12.1 libclntsh.so
203+
ln -s libocci.so.12.1 libocci.so
204+
```
205+
206+
Make sure that `libaio` is installed.
207+
208+
To run applications, you will need to set the link path:
209+
210+
```
211+
export LD_LIBRARY_PATH=/opt/oracle/instantclient_12_1
212+
```
213+
214+
Alternatively, if there is no other Oracle software on the machine
215+
that will be impacted, permanently add Instant Client to the run-time
216+
link path. Do this on Linux by creating a file
217+
`/etc/ld.so.conf.d/oracle-instantclient.conf` that contains the library
218+
location `/opt/oracle/instantclient_12_1`, and then run `ldconfig` as
219+
the root user.
220+
221+
### 3.4 Install the driver
222+
223+
Tell the installer where you installed Instant Client:
224+
225+
```
226+
export OCI_LIB_DIR=/opt/oracle/instantclient_12_1
227+
export OCI_INC_DIR=/opt/oracle/instantclient_12_1/sdk/include
228+
```
229+
230+
Run the installer:
231+
232+
```
233+
cd node-oracledb
234+
npm install -g
235+
```
236+
237+
### 3.5 Run an example program
238+
239+
Set `NODE_PATH` to include the newly installed node-oracledb driver:
240+
241+
```
242+
export NODE_PATH=$HOME/Desktop/node-v0.10.35-linux-x64/lib/node_modules
243+
```
244+
245+
Edit `dbconfig.js` in the `examples` directory and set the database
246+
credentials to your environment.
247+
248+
```
249+
module.exports = {
250+
user : "hr",
251+
password : "welcome",
252+
connectString : "localhost/XE"
253+
};
254+
```
255+
256+
Run one of the examples:
257+
258+
```
259+
node examples/select1.js
260+
```
261+
262+
*Note:* Remember to set `LD_LIBRARY_PATH` or equivalent first.
263+
264+
## <a name="instoh"></a> 4. Installation with a local database
265+
266+
The ORACLE_HOME can be either a database home or a full Oracle client installation.
267+
Make sure Node.js has permissions to read the libraries and other Oracle files.
268+
269+
For easy development, the free
270+
[Oracle XE](http://www.oracle.com/technetwork/database/database-technologies/express-edition/overview/index.html)
271+
version of the database is available on Linux. Node.js applications
272+
developed with XE may be immediately used with other editions of the
273+
Oracle Database.
274+
275+
### 4.1 Clone [this repository](https://github.com/oracle/node-oracledb)
276+
277+
```
278+
git clone https://github.com/oracle/node-oracledb.git
279+
```
280+
281+
### 4.2 Install Node.js
282+
283+
Download the
284+
[Node.js Linux 64-bit binaries](http://nodejs.org/download/) and
285+
extract the file, for example into `$HOME/Desktop`:
286+
287+
```
288+
cd $HOME/Desktop
289+
tar -zxf node-v0.10.35-linux-x64.tar.gz
290+
```
291+
292+
Set your PATH variable to include Node.js:
293+
294+
```
295+
export PATH=$HOME/Desktop/node-v0.10.35-linux-x64/bin:$PATH
296+
```
297+
298+
### 4.3 Install the driver
299+
300+
Tell the installer where to find the Oracle client:
301+
302+
```
303+
export OCI_LIB_DIR=$ORACLE_HOME/lib
304+
export OCI_INC_DIR=$ORACLE_HOME/rdbms/public
305+
```
306+
307+
Run the installer:
308+
309+
```
310+
cd node-oracledb
311+
npm install -g
312+
```
313+
314+
### 4.4 Run an example program
315+
316+
Set `NODE_PATH` to include the newly installed node-oracledb driver:
317+
318+
```
319+
export NODE_PATH=$HOME/Desktop/node-v0.10.35-linux-x64/lib/node_modules
320+
```
321+
322+
Set `LD_LIBRARY_PATH` to the Oracle library directory. This variable,
323+
and other variables used by Oracle clients, are typically set in a
324+
shell by executing:
325+
```
326+
source /usr/local/bin/oraenv
327+
```
328+
329+
If you are using Oracle XE, execute `source
330+
/u01/app/oracle/product/11.2.0/xe/bin/oracle_env.sh`.
331+
332+
Edit `dbconfig.js` in the `examples` directory and set the database
333+
credentials to your environment.
334+
335+
```
336+
module.exports = {
337+
user : "hr",
338+
password : "welcome",
339+
connectString : "localhost/XE"
340+
};
341+
```
342+
343+
Run one of the examples:
344+
345+
```
346+
node examples/select1.js
347+
```
348+

0 commit comments

Comments
 (0)