Skip to content

Buto/sails-oracledb-sp-example

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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 Future versions will include a working web UI

Installation

$ git clone https://github.com/nethoncho/sails-oracledb-sp-example.git
$ cd sails-oracledb-sp-example
$ npm install

Configuration

Edit the oraclehr adapter in the config/connections.js file to match your needs

module.exports.connections = {
  oraclehr: {
    adapter: 'oracle-sp',
    user: 'hr',
    password: 'welcome',
    package: 'HR',
    cursorName: 'DETAILS',
    connectString: 'localhost/xe'
  }
};

Apply the stored procedures to the HR schema in db/

$ cd db

The order is important

sqlplus "hr/welcome@localhost/xe" < create_pkg_hr-child.pls
sqlplus "hr/welcome@localhost/xe" < create_pkgbdy_hr-child.plb
sqlplus "hr/welcome@localhost/xe" < create_pkg_hr.pls
sqlplus "hr/welcome@localhost/xe" < create_pkgbdy_hr.plb
$ cd ..

Run the application

$ sails lift

Point your browser to http://127.0.0.1:1337/Employees

Routes

GET    /Employees
GET    /Employees/[EMPLOYEE_ID]
POST   /Employees
PUT    /Employees/[EMPLOYEE_ID]
DELETE /Employees/[EMPLOYEE_ID]

In this version of the example only EMAIL can be updated via put:

POST Body example

{
    "FIRST_NAME": "John",
    "LAST_NAME": "Doe",
    "EMAIL": "JDOE",
    "PHONE_NUMBER": "800-555-1212",
    "HIRE_DATE": "2014-07-07T04:00:00.000Z",
    "JOB_ID": "AD_PRES",
    "SALARY": 24000,
    "COMMISSION_PCT": 0.3,
    "MANAGER_ID": 100,
    "DEPARTMENT_ID": 90
}

PUT Body example

{
    "EMAIL": "JOHND"
}

License

MIT © 2015

About

An example sails application using oracle stored procedures

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 63.8%
  • PLSQL 35.6%
  • CSS 0.6%