Connectivity Guide > Connectivity Guide > Using Net > Connection to Remote Databases > Use of the SQL CONNECT Statement with Net
Was this helpful?
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.
Last modified date: 08/14/2024