Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Unable to get the db2 command prompt in unix Post 302261947 by ragavhere on Wednesday 26th of November 2008 04:44:35 AM
Old 11-26-2008
Hi,

Is the way i am connecting to DB2 right?

Quote:
Originally Posted by ragavhere
if [ $ERROR_CD = 01 ]; then
db2output=`DB2 <<EOD
connect to <DB name> user <username> using <password>
insert into <schema.tablename> (Col1,Col2,Col3,Col4,Col5,Col6) values('Val1','Val2','Val3','Val4','Val5','Val6');
terminate
EOD`
else
exit
fi
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Changing the UNIX command prompt

I am having a hard time figuring out how to change the command prompt in my UNIX shell. I am using the bash shell, and I would like to set the prompt to show me the full path of the current working directory along with my username, I suppose... The main thing I want is the full path of the... (2 Replies)
Discussion started by: WERUreo
2 Replies

2. IP Networking

Unable to get password prompt

Hi I am using a Solaris 2.5.1 and i am unable to logon on the console. When i key in say, root on the login prompt, it does not prompt me for password but instead return to the login prompt again. Please help. thanks (2 Replies)
Discussion started by: owls
2 Replies

3. Shell Programming and Scripting

how do i access db2 instance via telnet command prompt

Hi I have a perl script code in which connecting with db2 database and doing some process. My perl script code and db2 database server present in the same unix server. I am connecting and executing perl script code via windows telnet. Now my question is i could not able to connect db2 server... (4 Replies)
Discussion started by: solo123
4 Replies

4. UNIX for Dummies Questions & Answers

FTP that works correctly in command prompt and shows issue in UNIX server

Hi All, FTP ports opens with the given user name and password and allows to download file through COMMAND PROMPT. Code as below: H:\>ftp ftpxxxxx Connected to entvc2ft07-pub.xxxxx.com. 220 Microsoft FTP Service User (entvc2ft07-pub.xxxxx.com:(none)): userxxxxx 331 User name okay, need... (1 Reply)
Discussion started by: vijayalakshmi.r
1 Replies

5. UNIX for Advanced & Expert Users

Entire Input command not visible in Unix prompt

Hi, While typing the Unix command, entire command is not visible.When the input command is long, it is not visible. I want the entire command to be displayed when i type it. Please help to resolve this issue. Thanks Sampath (7 Replies)
Discussion started by: sampath.giri
7 Replies

6. Shell Programming and Scripting

Use Unix shell script to open Windows command prompt (cmd)

Hello, I work on Windows and I use Putty to access a remote UNIX server. I am trying to build a shell script that will have as main task to open the Windows command prompt (cmd) and run some Windows commands thereafter. The commands are actually file transfer commands that will download a file... (14 Replies)
Discussion started by: rookie2785
14 Replies

7. HP-UX

Unable to Set Prompt to current working DIR

HPUX does not recognise \h,\w,\u to display the hostname,working directory and username respectively. So how do i set the PS1 variable to display my current working Directory as my prompt? I also tried PS1=$PWD, But it keeps showing the same directory path as prompt which PWD was holding at... (3 Replies)
Discussion started by: Amit Kulkarni
3 Replies

8. UNIX Desktop Questions & Answers

Can Unix access Windows' File through Command Prompt in Unix

Hi all, I wish to know whether Unix can access window's file in Unix's terminal? Apart from that, how to copy files or share files between Window and Unix? I get to know of secure copy, however, my company's Unix does not support the feature of secure copy? Any other method for me to share/... (5 Replies)
Discussion started by: jessy83
5 Replies

9. Shell Programming and Scripting

DB2: load command in unix

I am currently trying to load data from e.txt into tablea. I am getting error. db2 connect to qw01p user wcs using abc db2 "LOAD CLIENT FROM /dswork/ECONT/output/interface/e.txt OF DEL MODIFIED BY coldel| SAVECOUNT 0 ROWCOUNT 0 WARNINGCOUNT 0 MESSAGES XTMPRTI1.txt REPLACE into WCSADM.TABLEA... (1 Reply)
Discussion started by: skatpally
1 Replies

10. Solaris

Unable to move from rsc prompt to ok prompt

Hi, on sunfire v890 unable to move from rsc prompt to ok prompt, i have executed the command break. (9 Replies)
Discussion started by: manoj.solaris
9 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)
All times are GMT -4. The time now is 11:30 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy