10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi,
I want to retrieve the base table name for a table and replace the table with the view name in the file.
I was trying to retrieve the base with the below db2 command but i am getting "1" as return value.
Could you anyone please assist ?
Table_name=system("db2 -x... (4 Replies)
Discussion started by: Nandy
4 Replies
2. UNIX and Linux Applications
What are the parameters ((i.e., Process & Services) need to monitor for SAP & DB2 to capture shutdown, restart & Halt status of those applications.
Please suggest the best practices.
Ex: SAPSTART for SAP & DP2SYS for DB2 (3 Replies)
Discussion started by: marunmeera
3 Replies
3. Shell Programming and Scripting
Hello,
i need some help with a script. I made a script, which connect to different hosts to get some informations. But i got now some problems with getting informations of a database (db2) which is on a other host. I tried something like
var=$(rsh HOST su - db2adm -c "db2 connect to database;... (2 Replies)
Discussion started by: Cyver
2 Replies
4. AIX
Hello dear friends, I have Lpar AIX 6.1 and there is DB2 installed. I have 8 Virtual CPU's configured on my Lpar and when I run nmon the CPU waiting time is always big.. I will provide screenshot for better realizing.. my question is what may produce so big waiting time?? Thanks in advance! (19 Replies)
Discussion started by: Vit0_Corleone
19 Replies
5. Shell Programming and Scripting
I want to connect to DB2 database which is mainframes using a unix script and run query and get the result set into the unix box.
Is this acheivable using db2 connect? pls help me with a sample script which can perform the same. (1 Reply)
Discussion started by: midhun19
1 Replies
6. AIX
Dear friends. can anybody suggest me what to be considered in order to achieve maximum performance of AIX on which DB2 will be installed
Thanks is advance :) (1 Reply)
Discussion started by: Vit0_Corleone
1 Replies
7. AIX
Dear friends I am going to study DB2 and i dont have any experience with any DB's.. Please provide me with some links or pdf's for DB2 starters.
any advice will be very usefull (2 Replies)
Discussion started by: Vit0_Corleone
2 Replies
8. Shell Programming and Scripting
i want to run a db2 query though shell script
but i want my where condition element to chnage everytime like class_nm='abc' next time class_nm='def' next time
i want it to do by passing parameters to unix script
can someone give example how can i do it (0 Replies)
Discussion started by: er_zeeshan05
0 Replies
9. UNIX for Dummies Questions & Answers
Hi...
I m working on UNIX z/OS. Actually i have to pass the parameters from the JCL to java-db2 program thru PARM. I am able to pass the arguments but the problem occured is, it is throwing an exception while loading the db2 driver as 'Javaclassnotfound:com.ibm.db2.jcc.DB2Driver'... (0 Replies)
Discussion started by: Sujatha Gowda
0 Replies
10. Shell Programming and Scripting
Having some trouble with usage of for loop and displaying words. Basically I had 3 words( some times more )
in the variable. I want to get one at a time to process.
I am new to unix scripting so please bear with my question and appreciate your reply. I think this can also me done my awk... (1 Reply)
Discussion started by: Vaddadi
1 Replies
DB2_GET_OPTION(3) 1 DB2_GET_OPTION(3)
db2_get_option - Retrieves an option value for a statement resource or a connection resource
SYNOPSIS
string db2_get_option (resource $resource, string $option)
DESCRIPTION
Retrieves the value of a specified option value for a statement resource or a connection resource.
PARAMETERS
o $resource
- A valid statement resource as returned from db2_prepare(3) or a valid connection resource as returned from db2_connect(3) or
db2_pconnect(3).
o $option
- A valid statement or connection options. The following new options are available as of ibm_db2 version 1.6.0. They provide use-
ful tracking information that can be set during execution with db2_get_option(3).
Note
Prior versions of ibm_db2 do not support these new options.
When the value in each option is being set, some servers might not handle the entire length provided and might truncate the
value.
To ensure that the data specified in each option is converted correctly when transmitted to a host system, use only the
characters A through Z, 0 through 9, and the underscore (_) or period (.).
o $userid
- SQL_ATTR_INFO_USERID - A pointer to a null-terminated character string used to identify the client user ID sent to the
host database server when using DB2 Connect.
Note
DB2 for z/OS and OS/390 servers support up to a length of 16 characters. This user-id is not to be confused with the
authentication user-id, it is for identification purposes only and is not used for any authorization.
o $acctstr
- SQL_ATTR_INFO_ACCTSTR - A pointer to a null-terminated character string used to identify the client accounting string
sent to the host database server when using DB2 Connect.
Note
DB2 for z/OS and OS/390 servers support up to a length of 200 characters.
o $applname
- SQL_ATTR_INFO_APPLNAME - A pointer to a null-terminated character string used to identify the client application name
sent to the host database server when using DB2 Connect.
Note
DB2 for z/OS and OS/390 servers support up to a length of 32 characters.
o $wrkstnname
- SQL_ATTR_INFO_WRKSTNNAME - A pointer to a null-terminated character string used to identify the client workstation name
sent to the host database server when using DB2 Connect.
Note
DB2 for z/OS and OS/390 servers support up to a length of 18 characters.
The following table specifies which options are compatible with the available resource types:
Resource-Parameter Matrix
+-----------+--------------------------+---+---+---+
| Key | | | | |
| | | | | |
| | Value | | | |
| | | | | |
| | Resource Type | | | |
| | | | | |
+-----------+--------------------------+---+---+---+
|Connection | | | | |
| | | | | |
| | Statement | | | |
| | | | | |
| | Result Set | | | |
| | | | | |
| userid | | | | |
| | | | | |
| | | | | |
| | SQL_ATTR_INFO_USERID | | | |
| | | | | |
| | X | | | |
| | | | | |
| | X | | | |
| | | | | |
| | - | | | |
| | | | | |
| acctstr | | | | |
| | | | | |
| | | | | |
| | SQL_ATTR_INFO_ACCTSTR | | | |
| | | | | |
| | X | | | |
| | | | | |
| | X | | | |
| | | | | |
| | - | | | |
| | | | | |
| applname | | | | |
| | | | | |
| | | | | |
| | SQL_ATTR_INFO_APPLNAME | | | |
| | | | | |
| | X | | | |
| | | | | |
| | X | | | |
| | | | | |
| | - | | | |
| | | | | |
|wrkstnname | | | | |
| | | | | |
| | | | | |
| | SQL_ATTR_INFO_WRKSTNNAME | | | |
| | | | | |
| | X | | | |
| | | | | |
| | X | | | |
| | | | | |
| | - | | | |
| | | | | |
+-----------+--------------------------+---+---+---+
RETURN VALUES
Returns the current setting of the connection attribute provided on success or FALSE on failure.
EXAMPLES
Example #1
Setting and retrieving parameters through a connection resource
<?php
/* Database Connection Parameters */
$database = 'SAMPLE';
$user = 'db2inst1';
$password = 'ibmdb2';
/* Obtain Connection Resource */
$conn = db2_connect($database, $user, $password);
echo "Client attributes passed through connection string:
";
/* Create the associative options array with valid key-value pairs */
/* Assign the attributes through connection string */
/* Access the options specified */
$options1 = array('userid' => 'db2inst1');
$conn1 = db2_connect($database, $user, $password, $options1);
$val = db2_get_option($conn1, 'userid');
echo $val . "
";
$options2 = array('acctstr' => 'account');
$conn2 = db2_connect($database, $user, $password, $options2);
$val = db2_get_option($conn2, 'acctstr');
echo $val . "
";
$options3 = array('applname' => 'myapp');
$conn3 = db2_connect($database, $user, $password, $options3);
$val = db2_get_option($conn3, 'applname');
echo $val . "
";
$options4 = array('wrkstnname' => 'workstation');
$conn4 = db2_connect($database, $user, $password, $options4);
$val = db2_get_option($conn4, 'wrkstnname');
echo $val . "
";
echo "Client attributes passed post-connection:
";
/* Create the associative options array with valid key-value pairs */
/* Assign the attributes after a connection is made */
/* Access the options specified */
$options5 = array('userid' => 'db2inst1');
$conn5 = db2_connect($database, $user, $password);
$rc = db2_set_option($conn5, $options5, 1);
$val = db2_get_option($conn5, 'userid');
echo $val . "
";
$options6 = array('acctstr' => 'account');
$conn6 = db2_connect($database, $user, $password);
$rc = db2_set_option($conn6, $options6, 1);
$val = db2_get_option($conn6, 'acctstr');
echo $val . "
";
$options7 = array('applname' => 'myapp');
$conn7 = db2_connect($database, $user, $password);
$rc = db2_set_option($conn7, $options7, 1);
$val = db2_get_option($conn7, 'applname');
echo $val . "
";
$options8 = array('wrkstnname' => 'workstation');
$conn8 = db2_connect($database, $user, $password);
$rc = db2_set_option($conn8, $options8, 1);
$val = db2_get_option($conn8, 'wrkstnname');
echo $val . "
";
?>
The above example will output:
Client attributes passed through connection string:
db2inst1
account
myapp
workstation
Client attributes passed post-connection:
db2inst1
account
myapp
workstation
SEE ALSO
db2_connect(3), db2_cursor_type(3), db2_exec(3), db2_set_option(3), db2_pconnect(3), db2_prepare(3).
PHP Documentation Group DB2_GET_OPTION(3)