10 More Discussions You Might Find Interesting
1. Solaris
Hi guys, long time no typing :D
I have problems when I try to connect to Oracle database from SQL Developer which is located on my Windows box.
Server is running Solaris 11/11 and Oracle 11 enterprise. I can log in locally with sys account to database, start it up and shut it down but when I... (2 Replies)
Discussion started by: solaris_user
2 Replies
2. Shell Programming and Scripting
Hi experts.
I have different database and schema and their passwords in one file.
In Unix : I want to create the script that connect the sqlplus and execute the select query one by one schema with different database.
Ex: password File Format
databse schemaname password
DB1 name1 ... (1 Reply)
Discussion started by: abhigrkist
1 Replies
3. Shell Programming and Scripting
Hi all,
In my concern they gave a task to me do cran job like
To write a shell script for
To connect a database
it should execute a query
it should save the output of the query
after getting the output it should send a mail to you inbox for every one hour
I can able to... (8 Replies)
Discussion started by: thelakbe
8 Replies
4. Shell Programming and Scripting
Hai
i want to connect to oracle database from user input and create a view.
${ECHO} "Debut Creating View"
${ECHO} "Please Enter the User Name:"
read user_name
${ECHO} "Please Enter the Connection String:"
read con_string
${ECHO} "Please Enter the Password:"
read pwd... (3 Replies)
Discussion started by: shenthil76
3 Replies
5. Shell Programming and Scripting
Hi,
My requirement is to generate a single text output which fetches data from two different databases. I have two different sqrs to generate text file1(data from db1) and file2(data from db2). can I execute both the sqrs from a single shell script? If yes, pls let me know how to connect to db2... (1 Reply)
Discussion started by: vimalr
1 Replies
6. Shell Programming and Scripting
Hi,
I want to write a shell script which connects to a Database, executes a set of SQLs and displays a message for every SQL that was run whether any records have been returned or not?
Can anyone help me in this regard?
Appreciate your help and concern.
Thanks,
Dave (1 Reply)
Discussion started by: yoursdavinder
1 Replies
7. UNIX for Advanced & Expert Users
I am trying to develop a script that can connect to a DB2 database mainframe and Query the database and display the results. I've been researching, but I have yet to find a definitive solution where I can enter in the Mainframe DB2 address db2:// and query the database and return the results. If... (2 Replies)
Discussion started by: developncode
2 Replies
8. Shell Programming and Scripting
if;
sql="select username from dba_users where username = '$FromUser';"
check_FromUser=`ExecSql "$sql"`
I want to connect to Oracle database & check the users in the database, store the value in check_FromUser.
First how to connect to Oracle database from the shell script ?
Appreciate your... (4 Replies)
Discussion started by: dreams5617
4 Replies
9. Shell Programming and Scripting
Hi,
While i am trying to connect to Oracle database from Perl using DBI module,am getting the error as follows :
Can't load '/usr/local/fuseperl-modules/lib/i586-linux-thread-multi/auto/DBD/Oracle/Oracle.so' for module DBD::Oracle: libwtc9.so: cannot open shared object file: No such file... (4 Replies)
Discussion started by: DILEEP410
4 Replies
10. UNIX for Advanced & Expert Users
hello -
Is it possible to connect to a database at the command line to an Oracle instance whilst logged in on the unix box i.e. not using a script
Cheers
(Running Solaris)
Also if anyone has any info on how a Citirix ICA client might be helpful here that would be appreciated
Cheers (1 Reply)
Discussion started by: penfold
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)