6.3. Translating SQLJ Programs

In this section, I describe how to translate your SQLJ programs in preparation for deployment to the JServer. You can translate your SQLJ program in one of the following ways:

  • Use the sqlj command-line utility.

  • Use the JDeveloper deployment wizard, which translates and loads the SQLJ program into the database.

This section covers the first method of translating your SQLJ program. The use of JDeveloper to deploy a SQLJ program is covered later in this chapter.

As I mentioned back in Chapter 1, profile files are small binary files that contain the names of the tables referenced in the SQLJ statements, among other items. Normally, profile files have the extension .ser and are generated when you translate your SQLJ program. If you have the sqlj command-line utility convert these files to class files, you will find it easier to load your SQLJ programs later. You may use the -ser2class option with the sqlj command-line utility to convert the files to class files.

In SQLJ 9i, using the -codegen=oracle option with the sqlj command-line utility skips generation of the profile files.

The following command uses the sqlj command-line utility to translate the ServerExample1.sqlj program. Notice the use of the -ser2class option:

sqlj -ser2class ServerExample1.sqlj

When you run this command, the following three class files are produced:

  • ServerExample1.class ...

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.