RE: How to connect as different user using dbaccess ?
Posted in 2004
Sergiy, Art,
The problem is that is a very bad idea to pass
the password in a command line. Any user who has access
to that machine is able to get this password by
simply issuing 'ps -ef'
I don't have any complete solution for that.
In some cases, the following approach works very well for me:
1. Connect to the database as a user with 'dba' privilege;
2. Issue 'SET SESSION AUTHORIZATION TO "any_other_user"'
This approach works very well for me, when I want
to connect to somebody's ANSI-mode database without
knowing the user's password as 'informix' and access
his objects without specifying object ownership in SQL statements
------------------------------------------
Alexey Sonkin
> -----Original Message-----
> From: owner-informix-list@iiug.org
[mailto:owner-informix-list@iiug.org]
> On Behalf Of Art S. Kagel
>
> smitin@gmail.com wrote:
>
>
> Do:
> > connect to dbname user 'user';
>
> DBAccess will prompt for a passwd. DBAccess will not accesp the USING
> clause. However, you cannot do this using a 'here script' because the
> password prompt goes directly to the tty NOT to stdin. Your best bet
> would
> be to use Jonathan Leffler's sqlcmd utility instead:
>
> sqlcmd -d mydatabase -u username -p password <<!
> SELECT.....
> !
>
> Sqlcmd is available for download from the IIUG Software Repository.
>
> Art S. Kagel
>
> > Hi there,
> >
> > pretty stupid question but I can't find an answer yet : how to
provide
> > user name and password if I want to use dbaccess ?
> > So far I tried dbaccess - - <<!
> > connect to dbname user 'user' using 'passwd';
> > !
> >
> > 32412: USING clause unsupported. DB-Access will prompt you for a
> > password.
> > Error in line 1> > Near character position 34
> >
> > I also tried
> > dbaccess -cc 'dbname' <<!> > user
> > password
> > !
> >
> > and ended with
> >
> > USER NAME >>userpasswd
> > Enter the login name you want to use for this connection.
> >
> > ------------------------------------------------ Press CTRL-W for
Help
> > --------
> >
> > Any ideas ?
> >
> > Regards,
> > Sergiy
> >
sending to informix-list