# SYSCS_UTIL.SYSCS_REGISTER_TOOL system procedure

The `SYSCS_UTIL.SYSCS_REGISTER_TOOL` system procedure loads and unloads optional tools packages.

## Syntax

    SYSCS_UTIL.SYSCS_REGISTER_TOOL(IN TOOLNAME VARCHAR(128),
                                   IN REGISTER BOOLEAN,
                                   IN OPTIONALARGS VARCHAR(128) ... )

No result set is returned by this procedure.

TOOLNAME
  The name of the optional tool. Must be one of the following case-sensitive names: `'databaseMetaData'`, `'foreignViews'`, `'luceneSupport'`, `'simpleJson'`, or `'rawDBReader'`.
REGISTER
  A value of true tells Derby to load the tool. A value of false tells Derby to unload the tool.
OPTIONALARGS
  Optional case-sensitive string arguments specific to each tool.

## Execute privileges

If authentication and SQL authorization are both enabled, only the database owner has execute privileges on this procedure by default. See "Configuring user authentication" and "Configuring user authorization" in the Derby Security Guide for more information. The database owner can grant access to other users.

## Usage

The following optional tools are supported:

- `databaseMetaData`

  This optional tool creates functions and table functions to wrap the methods in java.sql.DatabaseMetaData, allowing you to use DatabaseMetaData methods in queries. For example, you can join and filter the ResultSets returned by DatabaseMetaData methods. This tool does not require any optional arguments. To create the metadata functions and table functions, do the following:

      call syscs_util.syscs_register_tool( 'databaseMetaData', true )

  To drop the functions and table functions, do the following:

      call syscs_util.syscs_register_tool( 'databaseMetaData', false )

- `foreignViews`

  This optional tool creates schemas, table functions, and convenience views for all user tables in a foreign database. The table functions and views are useful for bulk-importing foreign data into Derby. This tool takes two additional arguments:

  CONNECTION_URL
    This is a connection URL string suitable for creating a connection to the foreign database by calling DriverManager.getConnection().
  SCHEMA_PREFIX
    This is an optional string prefixed to all of the schema names which the tool creates. This argument may be omitted. If it is omitted, then the tool will create schemas which have the same names as the schemas in the foreign database.

  To create views on the foreign data, do the following:

      call syscs_util.syscs_register_tool( 'foreignViews', true,
          'foreignDatabaseURL', 'XYZ_' )

  To drop the views on the foreign data, do the following:

      call syscs_util.syscs_register_tool( 'foreignViews', false,
          'foreignDatabaseURL', 'XYZ_' )

See the Derby Tools and Utilities Guide for more information on how to use these tools. Before you run an optional tool, make sure that your classpath contains the Derby jar files, including derbytools.jar.

Parent topic: Built-in system procedures