SQL/MX Programming Manual for Java
SQL/MX Programming Considerations
HP NonStop SQL/MX Programming Manual for Java—523726-003
4-36
Distributing SQL/MX Objects From an SQLJ
Program
Partitioning an SQL/MX Object on Remote Nodes
To partition an SQL/MX object across remote nodes, the catalog of that object must be
visible on all the remote nodes. That is, a catalog reference of the catalog must be
registered on all the remote nodes.
For example, this CREATE TABLE statement in an SQLJ program, which is executed
on the local node, \local, creates a primary partition of the JOB table on the local
node and distributes other partitions across the remote nodes, \remote1, \remote2,
and \remote3:
#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
)
STORE BY PRIMARY KEY
LOCATION \local.$samdb
ATTRIBUTE EXTENT (125000,125000) MAXEXTENTS 600
PARTITION
( ADD FIRST KEY (10000)
LOCATION \remote1.$samdb
EXTENT 900 MAXEXTENTS 300,
ADD FIRST KEY (20000)
LOCATION \remote2.$samdb
EXTENT (1024,2048) MAXEXTENTS 600,
ADD FIRST KEY (30000)
LOCATION \remote3.$samdb
MAXEXTENTS 599 EXTENT 66000)
};
Before running the program (or before issuing the CREATE TABLE statement in the
program), register the SAMDBCAT catalog on the remote nodes, \remote1,
\remote2, and \remote3, by issuing these REGISTER CATALOG statements on the
local node, \local:
#sql {REGISTER CATALOG samdbcat
ON \remote1.$samdb};
#sql {REGISTER CATALOG samdbcat
ON \remote2.$samdb};
#sql {REGISTER CATALOG samdbcat
ON \remote3.$samdb};
For more information about embedding the REGISTER CATALOG statement, see
Using Distributed Database Statements in an SQLJ Program on page 4-33. For more