web_plsql
0.5.0
このエクスプレスミドルウェアは、Oracleデータベースで実行されているPL/SQLアプリケーションとnode.jsのExpress Webサーバーの間のブリッジです。これは、mod_plsql、埋め込まれたpl/sqlゲートウェイ、およびORDに代わるオープンソースの代替品であり、pl/sql Web Toolkit(OWA)およびOracle Application Express(APEX)を使用してPL/SQL Webアプリケーションを開発し、Node.jsのExpress Webフレームワークを使用してコンテンツを提供することができます。
お気軽に改善をお試しください。あなたの考えやアイデアは大歓迎です。
Changelogを参照してください。
Oracleデータベースドライバーをコンパイルして実行するためには、いくつかの前提条件が必要です。詳細については、node-oracledb install.mdページにアクセスしてください。 Oracleがクライアントを探している場所について相談:https://oracle.github.io/node-oracledb/doc/api.html#oraclecleclientlientlowing
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 ) ;mit