CONNECTION_GROUP= LIBNAME Statement 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
CONNECT statement
Category: Data Set Control
Default: none
Data source: Amazon Redshift, Aster, DB2 under UNIX and PC Hosts, DB2 under z/OS, Greenplum, HAWQ, Impala, Informix, Microsoft SQL Server, MySQL, Netezza, ODBC, OLE DB, Oracle, PostgreSQL, SAP ASE, SAP HANA, SAP IQ, Snowflake, Teradata, Vertica, Yellowbrick
Note: Support for Yellowbrick was added in SAS 9.4M7.
See: CONNECTION= LIBNAME option
CAUTION

When you use a GLOBAL or single SHARED connection for multiple table opens, performing a commit or rollback on one table that is being updated also applies to all other tables that are open for update. Even if you open a table only for READ, its READ cursor might be resynchronized because of this commit or rollback. If the cursor is resynchronized, the new solution table might not match the original solution table that was being read.

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 operations on multiple librefs, if all participating librefs that the LIBNAME statements create meet these conditions:

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=myusr1
        pw=mypwd1
        connection_group=mygroup;
libname mydblib2 oracle user=myusr1
        pw=mypwd1
        connection_group=mygroup;
/* connection 2 */
libname mydblib3 oracle user=myusr1
        pw=mypwd1
        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;
Last updated: February 3, 2026