nonstop

 

Accessing MP Tables

Page history last edited by Anonymous 2 yrs ago

The SQLMX engine is used when a remote client accesss SQLMP data through JDBC/MX or ODBC/MX.

The SQLMX engine can be used to access SQLMP tables in order to use more advanced forms of SQL DML syntax.

 

In the SQLMX engine SQLMP tables are referenced in any of four ways.

  • using Guardian file name syntax.
  • using a Define inherited from the Guardian environment by the OSH command.
  • using a Define created in OSS (say by a .profile or set in the mxcs server datasource config by way of NSM/web).
  • using an SQLMP Alias that maps an ANSI name to a Guardian file name.

 

Using Guardian file name.

6> osh

$ mxci

>>select count(*) from $data06.persnl.employee;

 

Using a Define created in the Guardian environment.

8> add define =samdbee,class map,file $data06.persnl.employee

9> osh

$ info_define =SAMDBEE

DEFINE NAME = =SAMDBEE

CLASS = MAP

FILE =\WHD08.$DATA06.PERSNL.EMPLOYEE

$ mxci

>>select count(*) from =SAMDBEE;

 

 

Using a Define created in the OSS environment.

$ add_define =samdbsupp class=map file=\$data06.invent.supplier

$ mxci

>>select count(*) from =samdbsupp;

 

Using a Define created in the server datasource configuration.

In NSM/webm, for mxcs, in Data Source Configurations folder,

double-click the server data source. Click the Defines tab, click the + button.

Fill in the Add Define dialog box. Do not prefix the Define name with '=' and separate the attributes by commas.

 

 

The SQL statement in the Java application would look something like this:

 

results = stmt.executeQuery("select count(*) as theCount from =samdbsupplier");

 

Using an SQLMP Alias.

A catalog has been created and SQLMP Aliases have been added. A script like listalias.sh can display the aliases.

$ ./listalias.sh samdbcat

 

>> set schema samdbcat.DEFINITION_SCHEMA_VERSION_1200;

 

--- SQL operation complete.

>> select substring(cat_name,1,10) as Cat,

+> substring(schema_name,1,15) as SchemaName,

+> substring(object_name,1,15) as MPAlias,

+> mppartition_name as MPtablename

+> from mp_partitions mpp, objects obj,

+> Nonstop_sqlmx_whd08.system_schema.schemata sch,

+> Nonstop_sqlmx_whd08.system_schema.catsys cat

+> where mpp.object_uid = obj.object_uid

+> and obj.schema_uid = sch.schema_uid

+> and sch.cat_uid = cat.cat_uid

+> order by cat_name, schema_name ;

 

CAT SCHEMANAME MPALIAS MPTABLENAME

---------- --------------- --------------- ----------------------------------

SAMDBCAT INVENT PARTLOC \WHD08.$DATA06.INVENT.PARTLOC

SAMDBCAT INVENT SUPPLIER \WHD08.$DATA06.INVENT.SUPPLIER

SAMDBCAT INVENT PARTSUPP \WHD08.$DATA06.INVENT.PARTSUPP

SAMDBCAT PERSNL DEPT \WHD08.$DATA06.PERSNL.DEPT

SAMDBCAT PERSNL PROJECT \WHD08.$DATA06.PERSNL.PROJECT

SAMDBCAT PERSNL JOB \WHD08.$DATA06.PERSNL.JOB

SAMDBCAT PERSNL EMPLOYEE \WHD08.$DATA06.PERSNL.EMPLOYEE

SAMDBCAT SALES CUSTOMER \WHD08.$DATA06.SALES.CUSTOMER

SAMDBCAT SALES PARTS \WHD08.$DATA06.SALES.PARTS

SAMDBCAT SALES ORDERS \WHD08.$DATA06.SALES.ORDERS

SAMDBCAT SALES ODETAIL \WHD08.$DATA06.SALES.ODETAIL

 

--- 11 row(s) selected.

>>

>> exit;

 

End of MXCI Session

 

$ mxci

>>set schema samdbcat.persnl;

>>select count(*) from employee;

Comments (0)

You don't have permission to comment on this page.