Oracle8i Java Stored Procedures Developer's Guide Release 2 (8.1.6) Part Number A81358-01 |
Library | Service | Contents | Index

## Using dropjava

The `dropjava` utility accepts file names and/or schema object full names. After converting file names to schema object names, it drops the schema objects, then deletes their rows from the digest table. So, `dropjava` is the inverse of `loadjava`.

On the command line, you can enter the names of Java source, class, and resource files, SQLJ files, JARs, and ZIP archives in any order. Here is the syntax:

    dropjava {-user | -u} username/password[@database]
      [-option_name -option_name ...] file_name obj_name file_name ...

where `option_name` stands for the following syntax:

    {  {h | help}
     | {o | oci8}
     | {S | schema} schema_name
     | {s | synonym}
     | {t | thin}
     | {v | verbose} }

Names not ending with `.java`, `.class`, `.sqlj`, `.ser`, `.properties`, `.jar`, or `.zip` are assumed to be schema object names. If multiple schema objects have the same name, `dropjava` drops them all. Dropping a source drops classes derived from it. Dropping a class invalidates classes that depend on it directly or indirectly.

Table 2-3 describes the `dropjava` command-line options. The next two sections describe the required arguments `-user` and `file_name`.

##### Table 2-3 dropjava Options

Option | Description
--- | ---
`help` | Displays the `dropjava` help screen.
`oci8` | Directs `dropjava` to communicate with the database using the JDBC OCI driver. This option (the default) and `-thin` are mutually exclusive.
`schema` | Drops Java schema objects from the specified schema. If you do not specify this option, then the logon schema is used. To drop objects from another user's schema, you need the `DROP` `ANY` `PROCEDURE` privilege.
`synonym` | Drops a public synonym created by `loadjava`.
`thin` | Directs `dropjava` to communicate with the database using the client-side JDBC Thin driver. This option and `-oci8` (the default) are mutually exclusive.
`verbose` | Directs `dropjava` to display progress messages.

### Specifying the User

The argument `-user` specifies a username, password, and optional database connect string in the following format:

    username/password[@database]

With option `-oci8` (the default), the connect string `database` is optional. If you specify `database`, which can be a TNS name or Net8 name-value list, schema objects are dropped from the designated database. Otherwise, schema objects are dropped from the user's default database.

With option `-thin`, you must specify the connect string `database` in this format:

    @host:lport:SID

where `host` names the host computer, `lport` is the port configured to listen for Net8 connections, and `SID` is the database system identifier. With a default configuration, `lport` is `5521` and `SID` is `ORCL`.

### Specifying File Names

In general, `dropjava` and `loadjava` interpret file names the same way. With class files, `dropjava` finds the name of the class in the file, then drops the corresponding schema object. With source files and SQLJ input files, `dropjava` finds the name of the first class in the file, then drops the corresponding schema object. With JARs and ZIP archives, `dropjava` processes the names of archived files as if they were entered on the command line.

File names not ending with `.java`, `.class`, `.sqlj`, `.ser`, `.properties`, `.jar`, or `.zip` are assumed to be schema object names. If a file name begins with a slash, `dropjava` prefixes `ROOT` to the schema object name. If a file name does not match any schema object name, `dropjava` displays an error message, then processes the remaining file names.

#### Important Point

Always drop Java schema objects the same way you upload them. For example, if you upload SQLJ source files, then translate them on the server, use the same file names to drop them. If you upload resources individually, use the same file paths to drop them. To be safe, use a JAR to upload resources, then use the same JAR name to drop them.

### Examples

In the following example, `dropjava` connects to the default database using the JDBC OCI driver, then drops all objects from schema `BLAKE` that were loaded from `serverObjs.jar`:

    > dropjava -user scott/tiger -schema BLAKE serverObjs.jar

In the next example, `dropjava` connects to the specified database using the client-side JDBC Thin driver, then drops a class and resource from the user's schema:

    > dropjava -u scott/tiger@dbhost:5521:orcl -t Agent.class images.dat

### Running dropjava from an Application

A procedure named `dropjava()` in package `DBMS_JAVA` enables you to run the `dropjava` utility from an application. Here is the procedure spec:

    PROCEDURE dropjava (options VARCHAR2);

You can specify all the options except `-user`, `-oci8`, and `-thin` (because this version of `dropjava` always connects to the current session). Enclose the parameter with single quotes, as shown in the following example:

    CALL dbms_java.dropjava('-S JONES serverObjs.jar');

Relative path names are interpreted as relative to `ORACLE_HOME`. Output is directed to `stderr`.

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