You could use awk to produce the SQL statements to query the database and pipe the output to the DB2 CLP, for example
You will have to print the CONNECT TO statement in awk's BEGIN section.
Hi,
I am a beginner. I need an example of using DB2 Load Utility in Shell script.
I appreciate if anyone could help me about it.
Thanks,
Paris (0 Replies)
Hi All,
I want to connect two tables in DB2 using shell script and then compare the contents of two tables field by field. Could any one please help me in connecting database tables using Unix and retriving data from the same.
Thanks,
Durwas (0 Replies)
Is there a way to call a shell script via db2 trigger?
I want to wake up a shell script to perform some action if there is a insert action on a db2 table. (1 Reply)
Hi
I am trying to connect to db2 database from Unix shell script (k shell)
I need to catch the status of connect whether it is succesful or not.
----------------------------------------------------------
# Read login credentials for db2
tput clear
echo "Please enter your Userid:\c"... (3 Replies)
Guys,
I am trying to write a shell script that connect to wcsprod database and read the query
#!/bin/ksh
sqlplus -s < connect to wcsprod user wcsadm using pwd >
select * from catentry fetch first 1 row only with ur;
databse: wcsprod
user: wcsadm
pwd: pwd
thanks (1 Reply)
Hi ,
I have to create a db2 connection for the while loop in shell scripting.
Below is the connection for DB2 I have to establish
connect to TABLESCHENMA user $USERID using $PASSWORD
Below is the while loop.
while read TABLE; do
db2 LOAD CLIENT FROM
$DIRECTORY/$TABLE.ixf OF ixf INSERT... (1 Reply)
Hi,
I have shell script which will read single edi document and break data between ST & SE to separate files.Below example should create 3 separate files. I have written script with the below command and it is working fine for smaller files.
awk -F\| -vt=`date +%m%d%y%H%M%S%s` \
... (2 Replies)
Hi all,
I have a requirement to connect DB2 database and do some operations and generate a report through shell script.
Can anyone please tell me how can i connect DB2 from unix shell script?
Thanks in ADV. (2 Replies)
Hi,
Im new to DB2.
I need to connect to DB2 from shell script and return the query output back to shell script variable.
this is my code
#!/bin/ksh
db_name=db
db_user=usr
db_pwd=pwd
db2 <<EOSQL
connect to $db_name user $db_user using "$db_pwd"
select count(1) from table
quit
EOSQL ... (3 Replies)
Discussion started by: sup
3 Replies
LEARN ABOUT PHP
db2_close
DB2_CLOSE(3) 1 DB2_CLOSE(3)db2_close - Closes a database connectionSYNOPSIS
bool db2_close (resource $connection)
DESCRIPTION
This function closes a DB2 client connection created with db2_connect(3) and returns the corresponding resources to the database server.
If you attempt to close a persistent DB2 client connection created with db2_pconnect(3), the close request is ignored and the persistent
DB2 client connection remains available for the next caller.
PARAMETERS
o $connection
- Specifies an active DB2 client connection.
RETURN VALUES
Returns TRUE on success or FALSE on failure.
EXAMPLES
Example #1
Closing a connection
The following example demonstrates a successful attempt to close a connection to an IBM DB2, Cloudscape, or Apache Derby database.
<?php
$conn = db2_connect('SAMPLE', 'db2inst1', 'ibmdb2');
$rc = db2_close($conn);
if ($rc) {
echo "Connection was successfully closed.";
}
?>
The above example will output:
Connection was successfully closed.
SEE ALSO db2_connect(3), db2_pclose(3), db2_pconnect(3).
PHP Documentation Group DB2_CLOSE(3)