473,327 Members | 2,090 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,327 software developers and data experts.

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 13095
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Laura P | last post by:
Hi, I wasn't sure whether this should be posted in the Java are or in a Solaris thread, so I shall post it in both. Sorry for the duplication. I am new to Solaris and am having trouble...
5
by: Doug | last post by:
In vb6, to get the command line you would use strCommand = Command() How do you do this in vb .net? I found in the help file to use: Dim commands As String = Microsoft.VisualBasic.Command( but...
6
by: PAPutzback | last post by:
The process and execute methods want a path to the executable otherwise they kick out a file not found. So how can I execute the following. It works fine from a command window. echo password|...
14
by: Kevin | last post by:
A couple of easy questions here hopefully. I've been working on two different database projects which make use of multiple forms. 1. Where's the best/recommended placement for command buttons...
8
by: Ivan | last post by:
Hi I am new in DB2, and I have some problems when I try run stored procedures, and others statements. I made one stored procedure very simple, but this show different messages. I have followed...
2
by: johnxhc | last post by:
I am trying to use sos extension but almost half of the sos command do not work, for example 0:027!findtable No export findtable found 0:027!bpmd No export bpmd found 0:027!GCHandleLeaks...
13
by: Chris Carlen | last post by:
Hi: Having completed enough serial driver code for a TMS320F2812 microcontroller to talk to a terminal, I am now trying different approaches to command interpretation. I have a very simple...
2
by: db2learner | last post by:
Hi, I am new to DB2 and i just started worked on it a couple of days back. I have created basic EMPLOYEE table from control centre which has 2 fields: EmpNo, EmpName. I am trying to write...
2
by: Bennett Haselton | last post by:
How do I find the mapping between a PHP package name like HTTP_Request, and the "yum" command to install it on CentOS 4.4? For example when I needed to use LWP::UserAgent to use in Perl, the...
2
by: Taras_96 | last post by:
Hi everyone, I'm trying to run a number of commands stored within a sql file from within php using mysqli::query. The syntax I'm using is: source C:\data\projects\forum...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.