Access other database servers

You can access any table or routine in an external database by qualifying the name of the database object (table, view, synonym, or routine).

When the external database is on the same database server as the current database, you must qualify the object name with the database name and a colon. For example, to refer to a table in a database other than the local database, the following SELECT statement accesses information from an external database:
SELECT name, number FROM salesdb:contacts

In this example, the query returns data from the table, contacts, that is in the database, salesdb.

A remote database server is any database server that is not the current database server. When the external database is on a remote database server, you must qualify the name of the database object with the database server name and the database name, as the following example illustrates:
SELECT name, number FROM salesdb@distantserver:contacts

In this example, the query returns data from the table, contacts, that is in the database, salesdb on the remote database server, distantserver.

For the syntax and rules on how to specify database object names in an external database, see the HCL OneDB™ Guide to SQL: Syntax.