The LIBNAME Statement for Relational Databases |
Specifies
a user-defined initialization command to execute immediately
after every connection to the DBMS that is within the scope of the LIBNAME
statement or libref.
Default value: |
none
|
Valid in: |
SAS/ACCESS LIBNAME
statement
|
DBMS support: |
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
|
DBCONINIT=<'>DBMS-user-command<'>
|
-
DBMS-user-command
-
is any valid command that can be executed
by the SAS/ACCESS engine and that does
not return a result set or output parameters.
The initialization command that you select
can be a stored procedure or any DBMS SQL statement that might provide additional
control over the interaction between your SAS/ACCESS interface
and the DBMS.
The command executes immediately after each DBMS connection
is successfully established. If the command fails, then a disconnect occurs
and the libref is not assigned. You must specify the command as a single,
quoted string.
Note: The initialization command might execute more
than once, because one LIBNAME statement might have multiple connections--for
example, one for reading and one for updating. ![[cautionend]](../../../../common/63294/HTML/default/images/cautend.gif)
In the following example, the DBCONINIT= option causes
the DBMS to apply the SET statement to every connection that uses the MYDBLIB
libref.
libname mydblib db2
dbconinit="SET CURRENT SQLID='myauthid'";
proc sql;
select * from mydblib.customers;
insert into mydblib.customers
values('33129804', 'VA', '22809', 'USA',
'540/545-1400', 'BENNETT SUPPLIES', 'M. JONES',
'2199 LAUREL ST', 'ELKTON', '22APR97'd);
update mydblib.invoices
set amtbill = amtbill*1.10
where country = 'USA';
quit;
In the following example, a stored procedure is passed
to DBCONINIT=.
libname mydblib oracle user=testuser pass=testpass
dbconinit="begin dept_test(1001,25)";
end;
The SAS/ACCESS engine
retrieves the stored procedure and executes
it.
DBCONTERM= LIBNAME Option
Copyright © 2010 by SAS Institute Inc., Cary, NC, USA. All rights reserved.