sails-oracledb-sp-example
v0.2.1
Published
a Sails application
Downloads
2
Readme
sails-oracledb-sp-example
About
Example sails project using the sails-oracledb-sp adapter
The current version exposes the Oracle HR Employee table via a REST API and websockets. It includes an Angular UI.
#Installation The setup procedure relies on Oracle's VM.
install VirtualBox Download and install Oracle VM VirtualBox on your host system
##Download the Oracle 12c VM The Oracle 12c VM is provided in an Open Virtual Appliance (OVA) file. An OVA is essentially an archive that includes a disk image and other supporting files that are suitable to be imported into VirtualBox as a VM. The VM provided by this OVA includes Oracle Linux 7 and Oracle Database 12c Release 1 Enterprise Edition.
Download the Oracle 12c OVA, which is the Oracle DB Developer VM. Launch it by double clicking it and then import it into VirtualBox.
After the VM is launched then it needs a bit of configuration.
Enable the Oracle 12c's VM's bidirectional clipboard.
In the VM's menu: Devices->shared clipboard->bidirectional.
Set the VM's memory for 3GB. Set the VM's memory for 3GB.
In the VM's menu: Machine->settings->system and configure for 3GB of memory.
Database Information:
- Oracle SID : cdb1
- Pluggable DB : orcl
- ALL PASSWORDS ARE : oracle
- The Linux Username and password is oracle.
Install Node
$sudo su -
# cd Downloads
# wget https://nodejs.org/dist/v0.12.7/node-v0.12.7-linux-x64.tar.gz
# tar xzf node-v0.12.7-linux-x64.tar.gz
# cd node-v0.12.7-linux-x64
Node.js is installed in /usr/local directory. The following command copies the files to the correct sub-directotories in /usr/local:
#for dir in bin include lib share; do cp -par ${dir}/* /usr/local/${dir}/; done
To verify version of node and npm, type:
#node --version
v0.12.7
#npm --version
3.3.8
Now install npm
#npm install -g npm
##Install the Oracle Instant Client 'Basic' and 'SDK' RPMs The Oracle VM comes with FireFox preinstalled.
Download both the Oracle Instant Client 'Basic' and Oracle Instant Client 'SDK' RPMs
Download Oracle Instant Client 'Basic' and Oracle Instant Client 'SDK' RPMs
After the download has completed then copy the downloaded rpms to /home/oracle/rpms and then install the packages as root
$mkdir /home/oracle/rpms
$mv /home/oracle/Downloads/*.rpm /home/oracle/rpms
$sudo su -
#cd /home/oracle/rpms
#rpm -ivh oracle-instantclient12.1-basic-12.1.0.2.0-1.x86_64.rpm
#rpm -ivh oracle-instantclient12.1-devel-12.1.0.2.0-1.x86_64.rpm
#exit
Add the following lines to /home/oracle/.bashrc:
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:$LD_LIBRARY_PATH
export PATH=/opt/node-v4.1.0-linux-x64/bin:$PATH
##Install git
sudo su -
#yum install git
exit
Installation
$ git clone https://github.com/nethoncho/sails-oracledb-sp-example.git
$ cd sails-oracledb-sp-example
$ npm install
$ bower install
Configuration
Edit the oraclehr adapter in the config/connections.js file to match your needs
module.exports.connections = {
oraclehr: {
adapter: 'oracle-sp',
user: 'scott',
password: 'tiger',
package: 'HR',
cursorName: 'DETAILS',
connectString: 'localhost/orcl'
}
};
Apply the stored procedures to the HR schema in db/
$ cd db
The order is important
sqlplus "scott/tiger@localhost/orcl" < create_pkg_hr-child.pls
sqlplus "scott/tiger@localhost/orcl" < create_pkgbdy_hr-child.plb
sqlplus "scott/tiger@localhost/orcl" < create_pkg_hr.pls
sqlplus "scott/tiger@localhost/orcl" < create_pkgbdy_hr.plb
sqlplus "scott/tiger@localhost/orcl" < create_type_retcodes.sql
$ cd ..
Run the application
launch Sails:
$ cd ~/sails-oracledb-sp-example
$ sails lift
Point your browser to http://localhost:1337/#/employees to start UI
License
MIT © 2015