Oracle8i SQLJ Developer's Guide and Reference Release 3 (8.1.7) Part Number A83723-01 |
Library | Service | Contents | Index

## Functionality of Translator Errors, Messages, and Exit Codes

This section provides an overview of SQLJ translator messages and exit codes.

### Translator Error, Warning, and Information Messages

There are three major levels of SQLJ messages you might encounter during the translation phase: error, warning, and information. Warning messages can be further broken down into two levels: non-suppressable and suppressable. Therefore, there are four message categories (in order of seriousness):

1. errors

2. non-suppressable warnings

3. suppressable warnings

4. information

You can control suppressable warnings and information by using the SQLJ `-warn` option, as described below.

Error messages, prefixed by `Error:`, indicate that one of the following has been encountered:

- a condition that would prevent compilation (for example, the source file contains a public class whose name does not match the base file name)

- a condition that would result in a runtime error if the code were executed (for example, the code attempts to fetch a `VARCHAR` into a `java.util.Vector`, using an Oracle JDBC driver)

If errors are encountered during SQLJ translation, then no output is produced (`.java` file or profiles), and compilation and customization are not executed.

Non-suppressable warning messages, prefixed by `Warning:`, indicate that one of the following has been encountered:

- a condition that would probably, but not necessarily, result in a runtime error if the code were executed (for example, a `SELECT` statement whose output is not assigned to anything)

- a condition that compromises SQLJ's ability to verify runtime aspects of your source code (for example, not being able to connect to the database you specify for online checking)

- a condition that presumably resulted from a coding error or oversight

SQLJ translation will complete if a non-suppressable warning is encountered, but you should analyze the problem and determine if it should be fixed before running the application. If online checking is specified but cannot be completed, offline checking is performed instead.

Note: For logistical reasons, the parser that the SQLJ translator employs to analyze SQL operations is not the same top-level parser that will be used at runtime. Therefore, errors might occasionally be detected during translation that will not actually cause problems when your application runs. Accordingly, such errors are reported as non-suppressable warnings, rather than fatal errors.

Suppressable warning messages, also prefixed by `Warning:`, indicate that there is a problem with a particular aspect of your application, such as portability. An example of this is using an Oracle-specific type such as `oracle.sql.NUMBER` to read from or write to the database.

Informational or status messages prefixed by `Info:` do not indicate an error condition. They merely provide additional information about what occurred during the translation phase.

Suppressable warning and status messages can be suppressed by using the various `-warn` option flags:

- `precision/noprecision`--The `noprecision` setting suppresses warnings regarding possible loss of data precision during conversion.

- `nulls/nonulls`--The `nonulls` setting suppresses warnings about possible runtime errors due to nullable columns or types.

- `portable/noportable`--The `noportable` setting suppresses warnings regarding SQLJ code that uses Oracle-specific features or might otherwise be non-standard and, therefore, not portable to other environments.

- `strict/nostrict`--The `nostrict` setting suppresses warnings issued if there are fewer columns in a named iterator than in the selected data that is to populate the iterator.

- `verbose/noverbose`--The `noverbose` setting suppresses status messages that are merely informational and do not indicate error or warning conditions.

See "Translator Warnings (-warn)" for more information about the `-warn` option and how to set the flags.

If you receive warnings during your SQLJ translation, then you can try running the translator again with `-warn=none` to see if any of the warnings are of the more serious (non-suppressable) variety.

Notes: For information about particular error, warning, and information messages, see "Translation Time Messages" and "Runtime Messages".

Table 9-1 summarizes the categories of error and status messages generated by the SQLJ translator.

##### Table 9-1 SQLJ Translator Error Message Categories

Message Category | Prefix | Indicates | Suppressed By
--- | --- | --- | ---
Error | `Error:` | fatal error that will cause compilation failure or runtime failure (translation is aborted) | n/a
Non-suppressable warning | `Warning`: | condition that prevents proper translation or might cause runtime failure (translation is completed) | n/a
Suppressable warning | `Warning`: | problem regarding a particular aspect of your application (translation is completed) | `-warn` option flags: `noprecision nonulls noportable nostrict`
Informational/status message | `Info`: | information regarding the translation process | `-warn` option flags: `noverbose`

### Translator Status Messages

In addition to the translator's error, warning, and information messages, SQLJ can produce status messages throughout all phases of SQLJ operation--translation, compilation, and customization. Status messages are output as each file is processed and at each phase of SQLJ operation.

You can control status messages by using the SQLJ`-status` option. This option is also discussed in "Real-Time Status Messages (-status)".

### Translator Exit Codes

The following exit codes are returned by the SQLJ translator to the operating system upon completion:

- 0 = no error in execution

- 1 = error in SQLJ execution

- 2 = error in Java compilation

- 3 = error in profile customization

- 4 = error in class instrumentation (the optional mapping of line numbers from your `.sqlj` source file to the resulting `.class` file)

- 5 = error in `ser2class` conversion (the optional conversion of profile files from `.ser` files to `.class` files)

  Notes: If you issue the `-help` or `-version` option, then the SQLJ exit code is 0. If you run SQLJ without specifying any files to process, then SQLJ issues help output and returns exit code 1.

| Copyright © 1996-2000, Oracle Corporation. All Rights Reserved. |
Library | Service | Contents | Index