O'Reilly logo

Java™ Oracle® Database Development by David J. Gallardo

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

SQLJ Statements and the SQLJ Translator

To use SQLJ, we embed SQLJ statements directly in our Java code. SQLJ statements are not valid Java source code, however, so we need to distinguish between SQLJ files and Java files. We do this by naming our SQLJ files with a .sqlj suffix. Then, instead of compiling them with the javac compiler, we need to process them with the SQLJ translator.

Normally, the SQLJ compiler does two things for you: It interprets the SQLJ file and creates a valid Java source file—a .java file—from it, then compiles the Java source file into an executable class file. The process is illustrated in Figure 7-1.

Figure 7-1. SQLJ compilation.

Connecting with SQLJ

Two things are required for a program to connect to a database using ...

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