Chapter Contents

Previous

Next
SAS/ACCESS Software for Relational Databases: Reference

Customizing DBMS Connect and Disconnect Exits

You can specify DBMS commands or stored procedures to be executed immediately after a DBMS connection or before a DBMS disconnect by using the LIBNAME options DBCONINIT= and DBCONTERM=, as in the following example:

libname myoralib oracle user=testuser 
   password=testpass path='myoraserver'
   dbconinit="EXEC MY_PROCEDURE";

proc sql;
   update myoralib.mytable set acctnum=123 
      where acctnum=567;
quit;

When the libref is assigned, the SAS/ACCESS engine connects to the DBMS and passes a command to the DBMS to execute the stored procedure MY_PROCEDURE. By default, a new connection to the DBMS is made for every table that is opened for updating, so MY_PROCEDURE is executed a second time after a connection is made to update the table MYTABLE.

To execute a DBMS command or stored procedure only after the first connection in a library assignment, you can use the DBLIBINIT= option. Similarly, the DBLIBTERM= option enables you to specify a command to be executed prior to the disconnection of only the first library connection, as in the following example.

libname myoralib oracle user=testuser password=testpass
   dblibinit="EXEC MY_INIT" dblibterm="EXEC MY_TERM";

Note:   DBLIBINIT= and DBCONINIT= are related LIBNAME options. For more information, see SAS/ACCESS LIBNAME Options. .   [cautionend]


Chapter Contents

Previous

Next

Top of Page

Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.