6.2. Designing Server-Based SQLJ Programs
The JServer JVM is integrated with the Oracle8i database, and as you might imagine, developing a SQLJ program to be run by the JServer JVM is somewhat different from developing the SQLJ programs you have seen so far. The following list highlights the issues unique to SQLJ programs designed to run within the JServer JVM:
The SQLJ runtime packages are available to the JServer JVM.
A connection to the database does not have to be made by your program because the JServer JVM already has a connection to the database.
The connection between your program and the database is permanent and therefore cannot be closed: attempts to close the connection are ignored.
There is no auto-commit functionality, so your program should commit or roll back the results of your SQL DML statements explicitly.
By default, Java programs running in the JServer JVM send their output to the database trace file. However, this output can be routed to the screen.
In the following sections, I discuss each of these issues in detail.
6.2.1. SQLJ Runtime Packages
SQLJ programming depends on a number of Java packages. When you write a SQLJ program for a JVM that is external to the database, you usually import SQLJ runtime packages such as oracle.sqlj.runtime.Oracle. However, when your target is the JServer JVM, which is integrated with the database, these packages are already available.
6.2.2. Database Connections
When your programs run in the JServer JVM, you do not ...
Get Java Programming with Oracle SQLJ 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.