469,286 Members | 2,522 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,286 developers. It's quick & easy.

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


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 <pwduserid@db2_serv02 /home/userid/testsp.sh

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

The error: db2: command not found.

May 14 '07 #1
10 12864
Justin wrote:
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 <pwduserid@db2_serv02 /home/userid/testsp.sh

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

The error: db2: command not found.
.... what is plink, what it does and why you think such command exists in
Aix?

Jan M. Nelken
May 14 '07 #2
Justin wrote:
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 <pwduserid@db2_serv02 /home/userid/testsp.sh

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

The error: db2: command not found.
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
May 14 '07 #3

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:
Justin wrote:
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 <pwduserid@db2_serv02 /home/userid/testsp.sh
The exact plink command worked with Linux but fails with AIX.
The error: db2: command not found.

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

Jan M. Nelken- Hide quoted text -

- Show quoted text -

May 14 '07 #4

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)

On May 14, 11:11 am, Lennart <erik.lennart.jons...@gmail.comwrote:
Justin wrote:
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 <pwduserid@db2_serv02 /home/userid/testsp.sh
The exact plink command worked with Linux but fails with AIX.
The error: db2: command not found.

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- Hide quoted text -

- Show quoted text -

May 14 '07 #5
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/...er7.html#plink

Dave.

--

May 14 '07 #6
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.

--

May 14 '07 #7
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
May 14 '07 #8
Dave Hughes wrote:
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.
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.
May 14 '07 #9
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.

--
May 15 '07 #10

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

:)

On May 14, 3:32 pm, "Dave Hughes" <d...@waveform.plus.comwrote:
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.

--

May 15 '07 #11

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

5 posts views Thread by Doug | last post: by
2 posts views Thread by johnxhc | last post: by
13 posts views Thread by Chris Carlen | last post: by
2 posts views Thread by Taras_96 | last post: by
reply views Thread by zhoujie | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.