Use of the SQL Connect Statement with Net
If you are using the connect statement in an application, connect to a database on a remote instance using the following syntax:
exec sql connect 'vnode::dbname[/server_class]'
Note: The vnode can be either a dynamic vnode specification (@host+) or a vnode name.
You must use the single quotes around the designation of the vnode and database names (and server class, if applicable). For example, assume that you have an application residing on “napoleon” that wants to open a session with the database “advertisers” on “eugenie.” The following statement performs this task (assuming also that “lady” is a valid vnode name for “eugenie”):
exec sql connect 'lady::advertisers';
Note that a server class is not specified in this statement; therefore the default server class defined on “eugenie” is used.
If the target database is accessed through an Enterprise Access or EDBC products, be sure to include the appropriate keyword for the server class. For example:
exec sql connect 'lady::advertisers/db2';
If the target database is accessed through Ingres Star, be sure to include the appropriate keyword for the server class. For example:
exec sql connect 'lady::advertisers/star';
When you are working over Ingres Net, you can use the -u flag with a command to imitate another user provided the User ID that you are working under on the remote node has the SECURITY privilege.