Joern Reder wrote:

> Hicham BOUZDAD wrote:
>
> > can i change a user  in a perl script using DBI.
> > I explain :
> > I want to do :
> >
> > $dbh = connect(....'user1',....)
> > ....
> > change_user_to ( 'user2' );        ###########   like in Postgresql
> > commande :        "  \c - user2 "
> > $dbh -> do ('...');
> >
> > this is because i want to have only ONE dbh  at each time.
>
> This is database dependent. Which database system do you use?
>
> I know the answer for these:
>
> Oracle: alter session set current_schema=USER
> MySQL:  use USER
> Sybase: use USER

If you've got the correct versions of Informix (check your Informix Guide
to SQL: Syntax manual), I believe you can use:

SET SESSION AUTHORIZATION 'newuser';

Otherwise, you have to reconnect.

> But be aware that this only changes the way how object names are
> resolved (relative to the currently selected default schema), and
> ensure, that the connected user has the rights to access the data of
> this schema.

Valid concerns...


--
Jonathan Leffler ([EMAIL PROTECTED], [EMAIL PROTECTED])
Guardian of DBD::Informix 1.00.PC1 -- see http://www.cpan.org/
#include <disclaimer.h>


Reply via email to