Oracle8i SQLJ Developer's Guide and Reference Release 8.1.5 A64684-01 |
|
This section describes how to verify that your Java uploads are properly stored into schema objects. This requires a preliminary discussion of short names and full names of your Java schema objects in the server.
As mentioned previously, each Java source, class, and resource is stored in its own schema object in the server. The name of the schema object is derived from the fully qualified name, which includes relevant path or package information. Dots are replaced by slashes, however. These fully qualified names (with slashes)--used for loaded sources, loaded classes, loaded resources, generated classes, and generated resources--are referred to in this chapter as schema object full names.
Schema object names, however, have a maximum of only 31 characters, and all characters must be legal and convertible to characters in the database character set. If any full name is longer than 31 characters or contains illegal or inconvertible characters, then the Oracle8i server converts the full name to a short name to employ as the name of the schema object, keeping track of both names and how to convert between them. If the full name is 31 characters or less and has no illegal or inconvertible characters, then the full name is used as the schema object name.
You can always specify a full name to the database by using the SHORTNAME()
routine of the DBMS_JAVA
package, which takes a full name as input and returns the corresponding short name. This is useful, for example, in querying the view USER_OBJECTS
. (See "Using the USER_OBJECTS View".)
In addition, there is a LONGNAME()
routine in the DBMS_JAVA
package, allowing you to specify a short name and have it converted to a full name.
You can query the database view USER_OBJECTS
to obtain information about schema objects--including Java sources, classes, and resources--that you own. This allows you, for example, to verify that sources, classes, or resources that you load are properly stored into schema objects.
Columns in USER_OBJECTS
include those listed in Table 11-1 below.
An OBJECT_NAME
in USER_OBJECTS
is the full name, unless the full name exceeds 31 characters or contains a character that is illegal or inconvertible to the database character set. In either of these circumstances, a short name is used instead.
If the server has to use a short name for a schema object--meaning that the OBJECT_NAME
in USER_OBJECTS
is a short name--you can use the LONGNAME()
routine of the server DBMS_JAVA
package to receive it from a query in full name format without having to know the short name format or the conversion rules. For example:
SQL*Plus> SELECT dbms_java.longname(object_name) FROM user_objects WHERE object_type='JAVA SOURCE';
This will show you all of the Java source schema objects in full name format so you can see if all of your sources were loaded properly. Where no short name is used, no conversion occurs since the short name and full name are identical.
You can use the SHORTNAME()
routine of the DBMS_JAVA
package to use a full name as a query criterion without having to know whether it was converted to a short name in the database. For example:
SQL*Plus> SELECT object_type FROM user_objects WHERE object_name=dbms_java.shortname('known_fullname');
This will show you the OBJECT_TYPE
of the schema object of the specified full name (presuming the full name is representable in the database character set). There will be an implicit conversion to the short name, if necessary. If no short name had to be used, then no conversion occurs because the full name and short name are actually the same in such cases.
STATUS
is character string that indicates the validity of a Java source schema object or resource schema object. A source schema object is VALID
if it compiled successfully; a class schema object is VALID
if it was resolved successfully. A resource schema object is always VALID
because resources are not resolved.
The following SQL*Plus
script accesses the USER_OBJECTS
view to display information about uploaded Java sources, classes, and resources.
COL object_name format a30 COL object_type format a15 SELECT object_name, object_type, status FROM user_objects WHERE object_type IN ('JAVA SOURCE', 'JAVA CLASS', 'JAVA RESOURCE') ORDER BY object_type, object_name;
You can optionally use wildcards in querying USER_OBJECTS
, as in the following example.
SELECT object_name, object_type, status FROM user_objects WHERE object_name LIKE '%Alerter';
This finds any OBJECT_NAME
entries that end with the characters: Alerter
For more information about USER_OBJECTS
, see the Oracle8i Java Stored Procedures Developer's Guide.