# ij SQL command behavior

Any command other than those documented in the `ij` command reference are handed to the current connection to execute directly. The statement's closing semicolon, used by `ij` to determine that it has ended, is not passed to the underlying connection. Only one statement at a time is passed to the connection. If the underlying connection itself accepts semicolon-separated statements (which Derby does not), they can be passed to the connection using `ij`'s Execute command to pass in a command string containing semicolon-separated commands.

`ij` uses the result of the JDBC execute request to determine whether it should print a number-of-rows message or display a result set.

If a JDBC execute request causes an exception, it displays the SQLState, if any, and error message.

Setting the `ij` property ij.showErrorCode to true displays the SQLException's error code (see ij properties reference).

The number-of-rows message for inserts, updates, and deletes conforms to the JDBC specification for any SQL statement that does not have a result set. DDL (data definition language) commands typically report "0 rows inserted/updated/deleted" when they successfully complete.

To display a result set, `ij` formats a banner based on the JDBC ResultSetMetaData information returned from getColumnLabel and getColumnWidth. Long columns wrap the screen width, using multiple lines. An & character denotes truncation (`ij` limits displayed width of a column to 128 characters by default; see MaximumDisplayWidth).

`ij` displays rows as it fetches them. If the underlying DBMS materializes rows only as they are requested, ij displays a partial result followed by an error message if there is a error in fetching a row partway through the result set.

`ij` verifies that a connection exists before issuing statements against it and does not execute SQL when no connection has yet been made.

There is no support in `ij` for the JDBC feature multiple result sets.

- ij command example

Parent topic: ij commands