Oracle8i SQLJ Developer's Guide and Reference Release 8.1.5 A64684-01 |
|
With few exceptions, writing SQLJ code for use in the Oracle8i server is identical to writing SQLJ code for client-side use. The few differences are due to Oracle JDBC characteristics or general Java characteristics in the server, rather than being specific to SQLJ.
When writing SQLJ code for use in the server, be aware of the following:
You should also be aware of class naming and class resolution considerations. These are discussed in "About Class Loading, Compiling, and Name Resolution".
The concept of connecting to the server is different when your SQLJ code is running in the server itself. Note the following issues and characteristics when writing code for use in the server:
#sql
statements.
Any SQLJ connection context instance or JDBC connection instance in your program communicates to the database through the database session that is executing your Java code.
Note the following characteristics of the Oracle JDBC server-side driver when writing code for use in the server:
COMMIT
or ROLLBACK
statements to implement or cancel your database updates:
#sql { COMMIT }; ... #sql { ROLLBACK };
Note: If you are using any kind of XA transactions, such as Java Transaction Service (JTS) transactions, you cannot use SQLJ or JDBC commit/rollback statements or methods. This applies particularly to Enterprise JavaBeans or CORBA objects, which typically use such transactions. See "Additional Vehicles for SQLJ in the Server". |
For more information about server-side JDBC and the server-side driver, see the Oracle8i JDBC Developer's Guide and Reference.
The default standard output device in the Oracle8i Java VM is the current trace file.
If you want to reroute all standard output from a program executing in the server (output from any System.out.println()
calls, for example) to a user screen, then you can execute the SET_OUTPUT()
procedure of the DBMS_JAVA
package, as follows (inputting the buffer size in bytes):
sqlplus> execute dbms_java.set_output(10000);
If you want your code executing in the server to expressly output to the user screen, you can also use the PL/SQL DBMS_OUTPUT.PUT_LINE()
procedure instead of the Java System.out.println()
method.
The PUT_LINE()
procedure is overloaded, accepting either VARCHAR2
, NUMBER
, or DATE
as input to specify what is printed.
For more information about the DBMS_OUTPUT
package, see the Oracle8i Supplied Packages Reference.