Three-Part Names

A three-part name specifies the relational database, the schema (or library depending on naming method), and the name of an object for use in an SQL statement.

An application running against the local database can direct SQL requests to either the local database or a remote database. The database qualifiers within an SQL statement are resolved and if all refer to the same database, the SQL statement is processed at that database. If the database qualifiers within an SQL statement do not all refer to the same database, an SQL0512 is signalled.

Explicit three-part names

The following example shows an SQL statement with an explicit remote RDB qualifier (RemoteRDB).

CRTSQLxxx PGM(MySchema/MyPgm) RDB(LocalRDB)     

  EXEC SQL SELECT * INTO :SERVICE FROM RemoteRDB/MySchema/MyTableA;      

  EXEC SQL COMMIT;      

Implicit three-part names

The following example shows two SQL statements, each with an implicit local RDB qualifier.

CRTSQLxxx PGM(MySchema/MyPgm) RDB(LocalRDB)     

  EXEC SQL SELECT * INTO :SERVICE FROM MyTableA;        

  EXEC SQL CALL MySchema/MyProcedureA;        

  EXEC SQL COMMIT;      

For more information on implicit RDB qualifiers, see SQL Reference.