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
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
connection -> connect -> {choose server} -> type user -> type password
-> {choose database}
The trick is, you can connect to the same instance.
HTH
smi...@gmail.com escribió:
> 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
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-inf...@iiug.org
[mailto:owner-inf...@iiug.org]
> On Behalf Of Art S. Kagel
>
> smi...@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
>
With all of that, I agree. The feature is there - I don't
particularly recommend its use. The code in SQLCMD does attempt to
zap the password argument - empirically, this has no effect on
Solaris, and probably not on other platforms either.
The original question was asking to provide the password in the
connect statement - SQLCMD does support that (and permits you to write
PASSWORD instead of USING, and also to abbreviate WITH CONCURRENT
TRANSACTIONS to WCT).
CONNECT TO 'dbase' AS 'myconn' USER 'me' PASSWORD 'mine' WCT;
CONNECT TO 'dbase' AS 'yourconn' USER 'you' USING 'yours'
WITH CONCURRENT TRANSACTIONS;
> 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
Ouch!
Yes, it works. It isn't a good general solution - it means everyone
has informix (or, at least, DBA) privileges...
>>On Behalf Of Art S. Kagel
>>
>>smi...@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.
>>> 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
--
Jonathan Leffler #include <disclaimer.h>
Email: jlef...@earthlink.net, jlef...@us.ibm.com
Guardian of DBD::Informix v2003.04 -- http://dbi.perl.org/
> Alexey Sonkin wrote:
> > 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'
>
> With all of that, I agree. The feature is there - I don't
> particularly recommend its use. The code in SQLCMD does attempt to
> zap the password argument - empirically, this has no effect on
> Solaris, and probably not on other platforms either.
Jonathan,
I remember going thru this with you when I was developing infotable, the tool
which prints out the schema of a database in a very readable format. I rejected
accepting user name and password as a command line option for the same reason
mentioned above. I finally setteled for the following option:
(a) set an environment variable INFOTPASS to point out to a file.
(b) that file contains connect information in the format dbname|user name|password
(c) set unix permission 600 to that file for security.
infotable will read from this file before connecting. IMO it is quite secured as long
as the password file's permission is not set incorrectly.
Perhaps you can implement same approach for sqlcmd.
The next version of SQLCMD - probably 77.0x - will support this with
the environment variable SQLCMDPASSWORDS (not INFOTPASS). I'm
meditating on whether - and how - to integrate this into all connect
statements; it is already operational for the command line connections
in SQLCMD. I also expect to make available to UPDBLOB et al.
I sent Ravi a pre-release (77.00) shortly before he announced his
retirement from c.d.i. I have not heard back from him since then,
probably for the obvious reasons.