Programming Guide |
Sets or changes the default connection
DBMS CONNECTIONconnection
connection
- Name of the connection to set as the default.
If an application declares two or more connections, the application can set a default connection with
DBMS
CONNECTION
. The default connection is used for all subsequent statements that do not use aWITH CONNECTION
orWITH CURSOR
clause.
// con1 is set to be the default connection.
// The INSERT statement has a WITH CONNECTION clause
// using connection con2.
// The SELECT statement uses the default connection.DBMS ENGINE sybaseDBMS DECLARE con1 CONNECTION FOR USER ":uname" \
PASSWORD ":pword" SERVER "s1" DATABASE "master"DBMS DECLARE con2 CONNECTION FOR USER ":uname" \
PASSWORD ":pword" SERVER "s2" DATABASE "videobiz"DBMS CONNECTION con1DBMS WITH CONNECTION con2 DECLARE c1 CURSOR FOR \
INSERT INTO tapes (title_id, copy_num, status) \
VALUES (::title_id, ::copy_num, ::status)DBMS WITH CURSOR c1 EXECUTE USING title_id, copy_num, statusDBMS SELECT title_id, name FROM titles
DECLARE CONNECTION
,WITH CONNECTION
,dm_is_connection