The ifxsqlj command

You use the java ifxsqlj command to translate and compile your Embedded SQLJ source code. You run the java ifxsqlj command at the DOS or UNIX™ prompt.

The syntax of the java ifxsqlj command is as follows:
java ifxsqlj optionlist filelist
optionlist
A set of options separated by spaces. Some options have prefixes to indicate they are to be passed to utilities other than the SQLJ translator, such as the Java™ compiler.
filelist
A list of filenames separated by spaces: for example, file1.sqlj file2.sqlj

You must include the absolute or relative path to the files in filelist.

The files can have the extension .sqlj or .java. You can specify .sqlj files together with .java files on the same command line.

If you have .sqlj and .java files that require access to code in each other's file, enter all of these files on the command line for the same execution of the java ifxsqlj command.

You can use an asterisk ( * ) as a wildcard to specify filenames; for example, c*.sqlj processes all files beginning with c that have the extension .sqlj.

When you run the java ifxsqlj command, your CLASSPATH environment variable must be set to include any directories that contain .class files and .ser files the translator needs to access for type resolution of variables in your Embedded SQLJ source code.

Basic options for the ifxsqlj command

The following table lists the basic options available for use with the java ifxsqlj command.

Option
Description
-d
Specifies the root output directory for generated .ser and .class files

If you do not specify this option, files are generated under the directory of the input .sqlj file.

-dir
Specifies the root output directory for generated .java files

If you do not specify this option, files are generated under the directory of the input .sqlj file.

-encoding
Specifies the GLS encoding for .sqlj and .java input files and for .java generated files

If unspecified, the setting of the file.encoding property for the Java interpreter is used.

The -encoding option is also passed to the Java compiler.

-help
Displays option names, descriptions, and current settings

The list displays:

  • The name of the option
  • The type of the option (for example, if it is Boolean) or a selection of allowed values
  • The current value
  • A description of the option
  • Whether the property is at its default, or was set by either a property file or the command line

No translation or compilation is performed when you specify the -help option.

-linemap
Enables the mapping of line numbers between the generated .java file and the original .sqlj file

The -linemap option is useful for debugging because it allows you to trace compilation and execution errors back to your Embedded SQLJ source code.

For the -linemap option to be effective, the name of the .sqlj source code file must match the name of the class it implements.

-props
Specifies the name of the property file from which to read options

The ifxprofp tool explains how to use property files.

-status
Displays status messages while the java ifxsqlj command is running
-version
Displays the version of Embedded SQLJ you are using

No translation or compilation is performed when you specify the -version option.

-warn
Specifies a list of flags in a comma-separated string for controlling the display of warning and information messages during translation

The flags are:

  • all/none. Turns on or off all warnings and information messages
  • null(default)/nonull. Specifies whether the translator checks nullable columns and nullable Java variable types for conversion loss when data is transferred between database columns and Java host variables

    The translator must connect to the database for this option to be in effect.

  • precision(default)/noprecision. Specifies whether the translator checks for loss of precision when data is transferred between database columns and Java variables

    The translator must connect to the database for this option to be in effect.

  • portable(default)/noportable. Turns on or off warning messages about the portability of Embedded SQLJ statements
  • strict(default)/nostrict. Specifies whether the translator checks named iterators against the columns returned by a SELECT statement and issues a warning for any mismatches

    The translator must connect to the database for this option to be in effect.

  • verbose(default)/noverbose. Turns on or off additional information messages about the translation process

    The translator must connect to the database for this option to be in effect.

For example, the following setting of the -warn option turns off all warnings and then turns on the precision and nullability checks:

-warn=none,null,precision

Advanced options for the ifxsqlj command

The following table lists the advanced options available for use with the java ifxsqlj command. Many of these options are for online checking, which is discussed in Online checking.

Option
Description
-cache
Turns on the caching of results from online checking

Caching saves you from unnecessary connections to the database in subsequent runs of the translator for the same file.

Results are written to the file SQLChecker.cache in your current directory. The cache holds serialized representations of all SQL statements that translated without errors or warnings. The cache is cumulative and grows through successive invocations of the translator.

You empty the cache by deleting the SQLChecker.cache file.

Caching is off by default; you turn caching on by setting the -cache option to true, 1, or on; for example, -cache=true. You turn caching off by setting the option to false, 0, or off.

-compile
Set this flag to false to disable processing of .java files by the compiler. This applies to generated .java files and to .java files specified on the command line.
-compiler-executable
Specifies a particular Java compiler for the java ifxsqlj command to use

If not specified, the translator uses javac. If you do not specify a directory path, the java ifxsqlj command searches for the executable according to the setting of your PATH environment variable.

-compiler-encoding-flag
Set this flag to false to prevent the value of the SQLJ -encoding option from being automatically passed to the compiler.
-compiler-output-file
If you have instructed the Java compiler to output its results to a file, use the -compiler-output-file option to specify the filename.
-driver
Specifies a list of JDBC drivers that can be used to interpret JDBC connection URLs for online checking (see Online checking)

You specify a class name or a comma-separated list of class names. For example, specify Informix® JDBC Driver as follows:

-driver=com.informix.jdbc.IfxDriver

-offline
Specifies a Java class to implement off-line checking

The default off-line checker class is sqlj.semantics.OfflineChecker.

Off-line checking only runs when online checking does not (either because online checking was not enabled or because it stopped because of error). Off-line checking verifies SQL syntax and the usage of Java types.

With off-line checking, there is no connection to the database.

-online
Specifies a Java class or list of classes to implement online checking

The default online checker class is sqlj.semantics.JdbcChecker.

You can specify an online checker class for a particular connection context, as in:

-online@ctxclass2=sqlj.semantics.JdbcChecker

You must specify a user name with the -user option for online checking to occur. The -password, -url, and -driver options must be appropriately set as well.

-password
Specifies a password for the user name set with the -user option

If you specify the -user option, but not the -password option, the translator prompts you for the password.

If you are using multiple connection contexts, the setting for -password for the default connection context also applies to any connection context that does not have a specific setting.

-ser2class
Set this flag to true to convert the generated .ser files to .class files. This is necessary if you are creating an applet to be run from a browser, such as Netscape 4.0, that does not support loading a serialized object from a resource file.

The original .ser file is not saved.

-url
Specifies a JDBC URL for establishing a database connection for online checking (see Database URLs and Online checking)

The URL can include a host name, a port number, and the Informix database name. The format is:

jdbc:informix-sqli://{<ip-address>| <domain-name>}:<port-number>[/<dbname>]: INFORMIXSERVER=<server-name>[;user=<username>; password=<password>;<name>=<value> [;<name>=<value>]...]

If you are using multiple connection contexts, the setting for -url for the default context also applies to any connection context that does not have a specific setting.

You can specify a URL for a particular connection context, as in -url@ctxclass2=....

Any connection context with a URL must also have a user name set for it (using the -user option) for online checking to occur.

-user
Enables online checking and specifies the user name with which the translator connects to the database (see Online checking)

For example, to enable online checking on the default connection context and connect with the user name fred, use the following option:

-user=fred

If you are using multiple connection contexts, the setting for -user for the default connection context also applies to any connection context that does not have a specific setting.

If you want to enable online checking for the default context, but turn off online checking for another connection-for example ctxcon2-you need to specify the -user option twice:

-user=fred -user@ctxcon2=

To enable online checking for a particular connection context, specify that context with the user name, as in:

-user@ctxcon3=joyce

The classes of the connection contexts you specify must all be declared in your source code or previously compiled into a .class file.

-vm
Specifies a particular Java interpreter for the java ifxsqlj command to use

You must also include the path to the interpreter. If you do not specify a particular Java interpreter using this option, the translator uses java as a default.

The -vm option must be specified on the command line; you cannot set it in a property file.