Re: Determining what database your connected to in a SP
Posted in 1998
On Mon, 19 Oct 1998, David Williams wrote: > D. Sandmann <sandman@cfer.com> wrote: > >I have a stored procedure that is distributed accross many databases > >[...] > >I would like the stored procedure to tell my shell script which > >database/instance it is being called from. > >[...] > >I do not want to hardcode that information into the stored procedure > >[...] > > $INFORMIXSERVER IS set when the stored procedure is run! > ^^ > > This appears to work ok!! > > I would use $INFORMIXSERVER (and nothing else!). Unfortunately, that doesn't help if the database connection is made using 'dbase@server1' notation -- INFORMIXSERVER could be set to server2, but the database is still on server1. > Nothing guarantees it is set but it appears to be, try a stored > procedure which does There's also a fair chance that the value of INFORMIXSERVER corresponds to the value when the OnLine server was started, which may or may not be the same as the one the user used. I have not, however, checked this so I could be wrong. Yours, Jonathan Leffler (jleffler@informix.com) #include <witticism.h> Guardian of DBD::Informix v0.60 -- http://www.perl.com/CPAN Informix IDN for D4GL & Linux -- http://www.informix.com/idn