O'Reilly logo

Expert Oracle and Java Security: Programming Secure Oracle Database Applications with Java by David Coffin

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Java Stored Procedure Example

Nothing speaks to a programmer more clearly than code. Let the example that I'm going to present serve as a guide to begin understanding how Java stored procedures work. You will see an Oracle header to the Java code shown in Listing 4-1 in bold font. And you will also observe the definition of an Oracle function, following the Java code, which encapsulates the Java code. You cannot call Java code directly from an Oracle query, but you can call the Oracle function or procedure which will then call and run the Java.

Place a bookmark here so you can refer back Listing 4-1 in the discussion that follows. We will load this code into the Oracle database shortly.

Listing 4-1. MyApp4 and f_get_oracle_time

SET ROLE appsec_role; ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required