Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

db2 command not found -tvf - Plink in AIX vs. Linux

132 views
Skip to first unread message

Justin

unread,
May 14, 2007, 9:17:26 AM5/14/07
to

We have a simple shell script called testsp.sh (located at /home/
userid)
Within the shell script, the following command is called:
db2 -tvf callsp.sql

When the shell script is run in command line mode, it works as
expected.
and running db2 -tvf ... in command line it also works.

The issue occurs when running using "plink"

start plink -pw <pwd> userid@db2_serv02 /home/userid/testsp.sh

The exact plink command worked with Linux but fails with AIX.

The error: db2: command not found.

Jan M. Nelken

unread,
May 14, 2007, 10:44:58 AM5/14/07
to

... what is plink, what it does and why you think such command exists in
Aix?

Jan M. Nelken

Lennart

unread,
May 14, 2007, 11:11:20 AM5/14/07
to

Dont know plink, but if db2 cant be found its usually because
environment is not setup properly. Tru sourcing db2profile in your
script, I.e.

. ~<instanceowner>/sqllib/db2profile
db2 connect to ...
db2 -tvf callsp.sql
...

/Lennart

Justin

unread,
May 14, 2007, 12:50:30 PM5/14/07
to

Plink is a utility to launch a unix session from dos. It is a sweet
app.


On May 14, 10:44 am, "Jan M. Nelken" <Unknown.U...@Invalid.Domain>
wrote:

> Jan M. Nelken- Hide quoted text -
>
> - Show quoted text -


Justin

unread,
May 14, 2007, 12:53:00 PM5/14/07
to

Lennart,

You are correct. Added...
. /home/userid/sqllib/db2profile
to the script and everything is fine.

Seems only to be an issue with AIX not Linux.

-Kevin

Linux: Developed by the people for the people; AIX: Developed by IBM
- for IBM (not for the people)

> /Lennart- Hide quoted text -

Dave Hughes

unread,
May 14, 2007, 3:23:40 PM5/14/07
to
Justin wrote:

>
> Plink is a utility to launch a unix session from dos. It is a sweet
> app.

More specifically, it's part of the PuTTY suite on Windows[1]. Plink[2]
is a command line telnet/rsh/ssh client. Very handy indeed.

[snip]


[1] http://www.chiark.greenend.org.uk/~sgtatham/putty/
[2] http://the.earth.li/~sgtatham/putty/0.60/htmldoc/Chapter7.html#plink

Dave.

--

Dave Hughes

unread,
May 14, 2007, 3:32:26 PM5/14/07
to
Justin wrote:

> You are correct. Added...
> . /home/userid/sqllib/db2profile
> to the script and everything is fine.
>
> Seems only to be an issue with AIX not Linux.

That's strange. At least under v8 (may be different with v9),
db2profile had to be manually sourced by users wishing to access DB2,
or added to the profile so it got sourced automatically on login, under
both Linux and AIX (certainly I've had to manually add it to bashrc for
various users on my Linux server).

IIRC, the GUI setup adds it automatically to the instance owner's
profile, unless you use the manual (non-GUI) setup in which case it
still needs adding manually.


Dave.

--

Knut Stolze

unread,
May 14, 2007, 4:35:13 PM5/14/07
to
Dave Hughes wrote:

> Justin wrote:
>
>>
>> Plink is a utility to launch a unix session from dos. It is a sweet
>> app.
>
> More specifically, it's part of the PuTTY suite on Windows[1]. Plink[2]
> is a command line telnet/rsh/ssh client. Very handy indeed.

Does it initiate a login shell? If not, then ~/.profile is not read and,
thus, the DB2 environment not set up because ~/sqllib/db2profile is not
sourced.

--
Knut Stolze
DB2 z/OS Utilities Development
IBM Germany

Darin McBride

unread,
May 14, 2007, 7:51:32 PM5/14/07
to
Dave Hughes wrote:

Actually, db2icrt adds it - so it shouldn't matter whether you use the GUI
or not to create the instance. The instance owner should always get it, if
the instance owner even has a .profile/.login/.bashrc to modify.

Dave Hughes

unread,
May 14, 2007, 9:03:42 PM5/14/07
to
Knut Stolze wrote:

> Dave Hughes wrote:
>
> > Justin wrote:
> >
> >>
> >> Plink is a utility to launch a unix session from dos. It is a
> sweet >> app.
> >
> > More specifically, it's part of the PuTTY suite on Windows[1].
> > Plink[2] is a command line telnet/rsh/ssh client. Very handy indeed.
>
> Does it initiate a login shell? If not, then ~/.profile is not read
> and, thus, the DB2 environment not set up because ~/sqllib/db2profile
> is not sourced.

Interesting point. PuTTY itself usually starts a login shell
(naturally). However, when called with a command line to execute, plink
DOES NOT start a login shell:

C:\>plink -ssh dave@nibbler echo $0
bash

(if it were a login shell, it ought to return -bash instead of bash).
If called with no command to execute (i.e. in interactive mode), plink
accepts input from stdin. In this case, it (unsurprisingly) DOES start
a login shell:

C:\>echo echo $0 | plink -ssh dave@nibbler
-bash

Despite the SSH documentation stating otherwise ("If command is
specified, it is executed on the remote host instead of a login shell")
it appears this is the opposite behaviour of the OpenSSH client under
Linux:

$ ssh dave@nibbler "echo $0"
-bash

$ echo 'echo $0' | ssh dave@nibbler
-bash

So, I guess the moral of the story is that if one wishes to run scripts
that access DB2 remotely over SSH, to ensure compatibility with
different SSH clients which may not start a full login shell, one
should ensure the script on the server sources
~db2inst1/sqllib/db2profile before attempting to access DB2.


Cheers,

Dave.

--

Justin

unread,
May 15, 2007, 9:02:32 AM5/15/07
to

Using Linux as the OS, we did not have an issue with DB2 version 8 or
9.
With AIX, we only use DB2 version 9 and had the issue.

I am really new to DB2 (couple months) - so my knowledge of profile
management is near zero

:)

0 new messages