Use the set connection statement to change the current connection. The statement’s syntax is as follows:
exec sql set connection {connection_name | default}
where default is the unnamed connection, if any.
The following example changes the current connection:
exec sql connect "ME" at connect1 using "SERVER1";
exec sql connect "ME" at connect2 using "SERVER2";
exec sql set connection connect1;
exec sql select user_id() into :myid;