我怎么还没有做到这一点?它现在在我的待办事项清单上。。
与此同时,你可以做这样的事情。
➜ examples echo "script lsEngines.js" | sql klrice/klrice
SQLcl: Release 21.3 Production on Tue Jul 20 13:33:26 2021
Copyright (c) 1982, 2021, Oracle. All rights reserved.
Last Successful login time: Tue Jul 20 2021 13:33:28 -04:00
Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.3.0.0.0
login.sql found in the CWD. DB access is restricted for login.sql.
Adjust the SQLPATH to include the path to enable full functionality.
ScriptEngineFactory Info
jdk.nashorn.api.scripting.NashornScriptEngineFactory@373f7450
Script Engine: Oracle Nashorn (14.0.2)
Engine Alias: nashorn
Engine Alias: Nashorn
Engine Alias: js
Engine Alias: JS
Engine Alias: JavaScript
Engine Alias: javascript
Engine Alias: ECMAScript
Engine Alias: ecmascript
Language: ECMAScript (ECMA - 262 Edition 5.1)
Disconnected from Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.3.0.0.0
我的“lsEngines.js”是这个内容
var ScriptEngineManager = Java.type("javax.script.ScriptEngineManager")
mgr = new ScriptEngineManager();
var factories = mgr.getEngineFactories();
factories.forEach(function(factory) {
ctx.write("ScriptEngineFactory Info\n" + factory.toString() + "\n");
var engName = factory.getEngineName();
var engVersion = factory.getEngineVersion();
var langName = factory.getLanguageName();
var langVersion = factory.getLanguageVersion();
ctx.write("\tScript Engine: "+engName+" ("+engVersion+")\n");
var engNames = factory.getNames();
engNames.forEach(function(name) {
ctx.write("\tEngine Alias: "+ name + "\n");
})
ctx.write("\tLanguage: "+langName+" ("+langVersion+")\n");
})