Java Stored Procedure in Oracle, Database Interaction (Page 1 of 5 )
The entire code has been tested with only Oracle 10g with version 10.2. It would also support any successive versions after Oracle 8i. But, I didn’t personally check all of those versions.
Stored Procedures being written in Java?
I contributed a very long series (about 20 parts) that covered database interaction with PL/SQL. I received good feedback from several readers from all parts of the world. Indeed with their request, I am still extending the same series (but with different titles).
I already introduced an article which explains what a stored procedure is. We also examined how to create, execute and drop stored procedures in an Oracle database. Now, we will examine a similar concept but turn a bit to Java. To follow this article, one should have at least a basic idea of Java (at least its syntax, compilation, and so on) together with a bit of PL/SQL knowledge. For a complete list of my PL/SQL articles, try searching through “igrep.”
Even though I am working on Oracle 10g (v10.2) now, right from version 8i, the Oracle database includes a fully functional Java Virtual Machine called “Oracle JVM.” Oracle and Sun have a long-term relationship for their applications and platform interoperability. One of the important technologies which came out of their growing relationship is “Java stored procedures.”
With that flexibility, suddenly many Java developers became something like “Oracle Developers for Java” or “Java Oracle developers.” Not only Java stored procedures, but Oracle has further integrated very tightly with almost all of the latest J2EE specification (including, SQL, JSP, EJB and so on). In fact, Oracle developed its own application server (Oracle Application Server or simple “10gAS”) to integrate with their other suites.
With Java stored procedures, developers have the ability to harness the power of Java when building database applications. Almost the entire core Java API can be used to develop stored procedures. And further they will be served as if they are “native” Oracle stored procedures (generally written in PL/SQL).
In this article, we will examine how to create our own Java stored procedure, right from scratch.