|
1 |
| -# OJVM based examples |
2 |
| -This folder stores Java based examples for the embedded JVM of the Oracle Database (a.k.a. OJVM). We are referring to plain Java code |
3 |
| -with embedded SQL statements, similar to client JDBC code. |
4 |
| - |
5 |
| -The motivations for running Java code directly in the database include: |
6 |
| -* reusing Java code, Java libraries, and Java skills (developers) for database modules written in Java thereby allowing the same |
7 |
| - language across the mid-tier and the database-tier. The embedded JVM (a.k.a. OJVM also allows JavaScript (see our examples), Scala |
8 |
| - (see [Igor Racic's examples](http://www.igorandsons.com/)). I also described in [chapter 5 of my book](https://www.amazon.com/dp/1555583296), how to run run Jython, Jacl, Scheme, and Groovy in the database |
9 |
| -* the other key reason for running Java directly in the database is performance; really? Yes, even if HotSpot or external JVMs run |
10 |
| - pure Java sligthly faster than OJVM (but no one runs pure Java code i.e., Fibonnaci computation in the database), running Java in |
11 |
| - the database cuts the network traffic incurred by the steps involved in processing SQL statements (i.e., parse, and/or bind, and/or |
12 |
| - execute, and fetches). |
13 |
| - You can see for yourself with the Trimlob and Workers examples (running both inside and outside the database). |
14 |
| - |
15 |
| - * OJVM allows calling out external SOAP and REST Web Services. [See the landing page for more details](http://www.oracle.com/technetwork/database/database-083829.html) |
16 |
| - |
17 |
| -## [Documentation](http://docs.oracle.com/database/122/JJDEV/toc.htm) |
18 |
| - |
19 |
| -## [What's in Oracle database 12c Release 2 for Java & JavaScript Developers?](http://bit.ly/2orH5jf) |
20 |
| -## [OTN Landing page](http://www.oracle.com/technetwork/database/application-development/java-db/overview/index.html) |
21 |
| -## [Community Forum](https://community.oracle.com/community/database/developer-tools/jvm) |
| 1 | + |
| 2 | +# Nashorn based examples |
| 3 | +Java 8 furnishes Nashorn, a JavaScript engine which runs on the JVM including JDK, JRE, and the embeded JVM in the Oracle database a..k.a. OJVM. |
| 4 | +This folder stores database related Nashorn based examples (i.e., plain JavaScript + SQL statements) including JavaScript Stored procedures with OJVM, and standalone/client JavaScript functions with JDK/JRE. |
| 5 | + |
| 6 | +For data access, Nashorn allows interoperability between Java and JavaScript, therefore, the SQL statements are invoked using JDBC which is a portable standard Java API. |
| 7 | +In addition to SQL statements, for JSON collections and documents, you can also use the fluent API (i.e., no SQL, dot notation) using SODA for Java with JavaScript, the beauty of Nashorn (see SODAjs.md for more details). |
| 8 | + |
| 9 | +For JavaScript Stored Procedures, the steps are very simple |
| 10 | +1) create/design your JavaScript function in a file |
| 11 | +2) load the JavaScript file into your database schema using the loadjava utility (DBMSJAVASCRIPT role required) |
| 12 | +3) invoke it using (i) either DBMS_JAVASCRIPT.run(<JS file>) or (ii) DbmsJavaScript.run Java call, or (iii) using javax.script API |
| 13 | + |
| 14 | +[See my blog post for more details](http://db360.blogspot.com/search?updated-max=2016-11-09T08:41:00-08:00&max-results=3) |
| 15 | + |
| 16 | +[Documentation](http://bit.ly/2nstiYQ) |
| 17 | + |
| 18 | +[White paper](http://bit.ly/2orH5jf) What's in Oracle database 12c Release 2 for Java & JavaScript Developers? |
| 19 | + |
| 20 | +[Community Forum](https://community.oracle.com/community/database/developer-tools/jvm) |
0 commit comments