web_plsql
0.5.0
該快速中間件是在Oracle數據庫中運行的PL/SQL應用程序與Node.js的Express Web服務器之間的橋樑。它是MOD_PLSQL,嵌入式PL/SQL網關和ORD的開源替代方案,可讓您使用PL/SQL Web Toolkit(OWA)(OWA)和Oracle Application Express(APEX)開發PL/SQL Web應用程序,並使用Node.js. J.J. J.J.
請隨時嘗試提出任何改進。您的想法和想法是最歡迎的。
請參閱Changelog。
編譯和運行Oracle數據庫驅動程序需要幾個先決條件。請訪問node-oracledB install.md頁面以獲取更多信息。關於Oracle在哪裡尋找客戶諮詢:https://oracle.github.io/node-oracledb/doc/api.html#oracleclecleclientloading
npm init )npm install web_plsql )sqlplus node_modules/web_plsql/examples/sql/install.sql )node node_modules/web_plsql/examples/sample )http://localhost:8000/base <Location /pls/sample>
SetHandler pls_handler
Order deny,allow
Allow from all
PlsqlDatabaseUsername sample
PlsqlDatabasePassword sample
PlsqlDatabaseConnectString ORCL
PlsqlAuthenticationMode Basic
PlsqlDefaultPage sample.pageindex
PlsqlDocumentTablename doctable
PlsqlErrorStyle DebugStyle
PlsqlNlsLanguage AMERICAN_AMERICA.UTF8
</Location>
const fs = require ( 'fs' ) ;
const path = require ( 'path' ) ;
const express = require ( 'express' ) ;
const bodyParser = require ( 'body-parser' ) ;
const multipart = require ( 'connect-multiparty' ) ;
const cookieParser = require ( 'cookie-parser' ) ;
const compression = require ( 'compression' ) ;
const morgan = require ( 'morgan' ) ;
const oracledb = require ( 'oracledb' ) ;
const webplsql = require ( '../lib' ) ;
/*
* Allocate the Oracle database pool
*/
const databasePool = oracledb . createPool ( {
user : 'sample' ,
password : 'sample' ,
connectString : 'ORCL' ,
poolMin : 10 ,
poolMax : 1000 ,
poolIncrement : 10 ,
queueRequests : false ,
queueTimeout : 1000
} ) ;
databasePool . catch ( e => {
console . error ( `Unable to create database pool.n ${ e . message } ` ) ;
process . exit ( 1 ) ;
} ) ;
/*
* Start the server
*/
const PORT = 8000 ;
const PATH = '/pls/sample' ;
const OPTIONS = {
defaultPage : 'sample.pageIndex' ,
doctable : 'docTable' ,
errorStyle : 'debug'
} ;
// create express app
const app = express ( ) ;
// add middleware
app . use ( multipart ( ) ) ;
app . use ( bodyParser . json ( ) ) ;
app . use ( bodyParser . urlencoded ( { extended : true } ) ) ;
app . use ( cookieParser ( ) ) ;
app . use ( compression ( ) ) ;
app . use ( morgan ( 'combined' , { stream : fs . createWriteStream ( path . join ( process . cwd ( ) , 'access.log' ) , { flags : 'a' } ) } ) ) ;
// add the oracle pl/sql express middleware
app . use ( PATH + '/:name?' , webplsql ( databasePool , OPTIONS ) ) ;
// serving static files
app . use ( '/static' , express . static ( path . join ( process . cwd ( ) , 'examples/static' ) ) ) ;
// listen on port
console . log ( `Waiting on http://localhost: ${ PORT } ${ PATH } ` ) ;
app . listen ( PORT ) ;麻省理工學院