JServer Program Support

Oracle states that you can run any Java program in JServer. This is not a false statement, but since JServer does not support servlets in Version 8.1.6, you have to consider the usefulness of what can be run.[1] You are really limited to two types of objects:

Stored procedures

These refer to any Java object with a static method that can be wrapped with a SQL function, procedure, or package.

Enterprise JavaBeans (EJB)

These use JDBC but are not executed using JDBC. Instead, they are executed using the IIOP protocol.

Since the use of JDBC by stored procedures and EJB is the same, I see no point in covering EJB here. One thing worth noting about internal Java programs is what happens when you make calls to System.out.println( ) and System.err.println( ). Where does this output go?

By default, any calls to the methods System.out.println( ) and System.err.println( ) goes into a trace file. That’s not very useful, but you can make the output go to the SQL*Plus screen buffer. The SQL*Plus screen buffer is the buffer that the SYS.DBMS_OUTPUT.PUT_LINE stored procedure uses. To send Java output to the SQL*Plus screen buffer, call the SYS.DBMS_JAVA.SET_OUTPUT( ) stored procedure from within your Java stored procedure. The syntax for doing that is:

SYS.DBMS_JAVA.SET_OUTPUT(BUFFER_SIZE IN NUMBER)

BUFFER_SIZE is an optional parameter. The default buffer size is 2,000 bytes, and the maximum value is 1,000,000 bytes. Of course, the SQL*Plus buffer is useful only while using ...

Get Java Programming with Oracle JDBC now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.