IBM Informix Embedded SQLJ User's Guide

######

IBM Informix Embedded SQLJ User's Guide Chapter 5: Processing Embedded SQLJ Source Code

Contents | Index |  |

## Command Options Many options are available to customize how you run the java ifxsqlj command: Basic options are described in the next section. Advanced options are described on page 5-8. You can set options either on the command line or in property files. Options set on the command line can be passed to the SQLJ translator, the Java compiler, or the Java interpreter. Options set in property files can be passed to the SQLJ translator or the Java compiler, but not to the Java interpreter. For more information, see "Setting Options on the Command Line" and "Supplying Options in Property Files". ### Basic Options 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 The following table lists the advanced options available for use with the java ifxsqlj command. Many of these options are for on-line checking, which is discussed in "On-Line Checking".

Option | Description
--- | ---
-cache | Turns on the caching of results from on-line 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 | Setting this flag to `false` disables 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 unset, 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 on-line checking (see "On-Line 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 on-line checking does not (either because on-line 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 on-line checking. The default on-line checker class is sqlj.semantics.JdbcChecker You can specify an on-line 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 on-line 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 | Setting this flag to `true` converts 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 on-line checking (see "Database URLs" and "On-Line Checking"). The URL can include a host name, a port number, and an 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 on-line checking to occur.
-user | Enables on-line checking and specifies the user name with which the translator connects to the database (see "On-Line Checking"). For example, to enable on-line 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 on-line checking for the default context, but turn off on-line checking for another connection-for example ctxcon2-you need to specify the -user option twice: `-user=fred -user@ctxcon2=` To enable on-line 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.

IBM Informix Embedded SQLJ User's Guide, Version 1.0
Copyright © 1999, IBM Corporation. All rights reserved.