CONNECTION_GROUP= LIBNAME Option

Causes operations on multiple librefs and on multiple SQL pass-through facility CONNECT statements to share a connection to the DBMS.
Valid in: SAS/ACCESS LIBNAME statement
Default: none
Data source: Aster nCluster, DB2 under UNIX and PC Hosts, DB2 under z/OS, Greenplum, HP Neoview, Informix, Microsoft SQL Server, MySQL, Netezza, ODBC, OLE DB, Oracle, Sybase, Sybase IQ, Teradata
See: CONNECTION= LIBNAME option

Syntax

CONNECTION_GROUP=connection-group-name

Syntax Description

connection-group-name
name of a connection group.

Details

This option causes a DBMS connection to be shared by all READ operations on multiple librefs if all participating librefs that LIBNAME statements create specify these items:
  • the same value for the CONNECTION_GROUP= option
  • identical DBMS connection options
To share a connection for all operations against multiple librefs, specify CONNECTION=GLOBAL on all participating LIBNAME statements. Not all SAS/ACCESS interfaces support CONNECTION=GLOBAL.
If you specify CONNECTION=GLOBAL or CONNECTION=GLOBALREAD, operations on multiple librefs can share a connection even if you omit CONNECTION_GROUP=.
Informix: The CONNECTION_GROUP option enables multiple librefs or multiple SQL pass-through facility CONNECT statements to share a connection to the DBMS. This overcomes the Release 8.2 limitation where users were unable to access scratch tables across step boundaries as a result of new connections being established with every procedure.

Example: Share a Connection with Identical Connection Options

In this example, the MYDBLIB libref shares a connection with MYDBLIB2 by specifying CONNECTION_GROUP=MYGROUP and by specifying identical connection options. The libref MYDBLIB3 makes a second connection to another connection group called ABC. The first connection is used to print the data from and also for updating MYDBLIB.TAB. The third connection is closed at the end of the step. The first connection is closed by the final LIBNAME statement for that connection. Similarly, the second connection is closed by the final LIBNAME statement for that connection.
/* connection 1 */
libname mydblib oracle user=testuser
        pw=testpass
        connection_group=mygroup;
libname mydblib2 oracle user=testuser
        pw=testpass
        connection_group=mygroup;
/* connection 2 */
libname mydblib3 oracle user=testuser
        pw=testpass
        connection_group=abc;
proc print data=mydblib.tab…
/* connection 1 */
proc sql;
   update mydblib.tab…
/* does not close connection 1*/
libname mydblib clear;
/* closes connection 1 */
libname mydblib2 clear;
/* closes connection 2 */
libname mydblib3 clear;