SQL/MX Programming Manual for Java

SQL/MX Programming Considerations
HP NonStop SQL/MX Programming Manual for Java523726-003
4-35
Distributing SQL/MX Objects From an SQLJ
Program
For example, this SQLJ program removes a catalog reference from the target node,
\remote:
#sql {UNREGISTER CATALOG samdbcat
FROM \remote.$samdb};
After running the SQLJ program, the SAMDBCAT catalog is no longer visible on the
target node, \remote. Users can no longer query SQL/MX objects in the SAMDBCAT
catalog from the remote node, \remote.
The UNREGISTER CATALOG statement affects subsequent compilation and
execution of DML, DDL, and utility commands from the target node but does not affect
executing applications that have already accessed objects in the catalog from the
target node.
For the syntax of the UNREGISTER CATALOG statement, see the SQL/MX Reference
Manual. For information about maintaining a network-distributed SQL/MX database
environment, see the SQL/MX Installation and Management Guide.
Distributing SQL/MX Objects From an SQLJ Program
From an SQLJ program, you can create, alter, or drop an SQL/MX object that resides
entirely on a remote node or that is partitioned across remote nodes.
Creating an Entire SQL/MX Object on a Remote Node
To create (or alter or drop) an entire SQL/MX object on a remote node, the catalog of
the object must be visible on the local node. That is, a catalog reference of the catalog
must be registered on the local node.
For example, this CREATE TABLE statement in an SQLJ program, which runs on the
local node, \local, creates the JOB table on the remote node, \remote:
#sql {CREATE TABLE samdbcat.persnl.job
( jobcode NUMERIC (4) UNSIGNED
NO DEFAULT
NOT NULL NOT DROPPABLE
HEADING 'Job/Code'
,jobdesc VARCHAR (18)
DEFAULT 0
HEADING 'Job Description'
,PRIMARY KEY (jobcode) NOT DROPPABLE
)
LOCATION \remote.$samdb
};
Before running the program, register the SAMDBCAT catalog on the local node,
\local, by issuing this REGISTER CATALOG statement on the remote node,
\remote:
#sql {REGISTER CATALOG samdbcat
ON \local.$samdb};