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. Windows & DOS: Issues & Discussions
Hi,
Am running my client in Windows and the database (IBM DB2) is in AIX machine. if I open my client its not connecting to the database at first time and failing in a particular SQL Query. But if I close the client and open again then its connecting and the query is also working fine. Don't... (0 Replies)
Discussion started by: mvictorvijayan
0 Replies
8. Shell Programming and Scripting
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
9. 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
10. 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
OCI_NEW_CONNECT(3) OCI_NEW_CONNECT(3)
oci_new_connect - Connect to the Oracle server using a unique connection
SYNOPSIS
resource oci_new_connect (string $username, string $password, [string $connection_string], [string $character_set], [int $ses-
sion_mode])
DESCRIPTION
Establishes a new connection to an Oracle server and logs on.
Unlike oci_connect(3) and oci_pconnect(3), oci_new_connect(3) does not cache connections and will always return a brand-new freshly opened
connection handle. This is useful if your application needs transactional isolation between two sets of queries.
PARAMETERS
o $username
- The Oracle user name.
o $password
- The password for $username.
o $connection_string
-Contains the Oracle instance to connect to. It can be an Easy Connect string, or a Connect Name from the tnsnames.ora file, or
the name of a local Oracle instance. If not specified, PHP uses environment variables such as TWO_TASK (on Linux) or LOCAL (on
Windows) and ORACLE_SID to determine the Oracle instance to connect to. To use the Easy Connect naming method, PHP must be linked
with Oracle 10 g or greater Client libraries. The Easy Connect string for Oracle 10 g is of the form: [//]host_name[:port][/ser-
vice_name]. From Oracle 11 g, the syntax is: [//]host_name[:port][/service_name][:server_type][/instance_name]. Service names can
be found by running the Oracle utility lsnrctl status on the database server machine. The tnsnames.ora file can be in the Oracle
Net search path, which includes $ORACLE_HOME/network/admin and /etc. Alternatively set TNS_ADMIN so that $TNS_ADMIN/tnsnames.ora
is read. Make sure the web daemon has read access to the file.
o $character_set
-Determines the character set used by the Oracle Client libraries. The character set does not need to match the character set used
by the database. If it doesn't match, Oracle will do its best to convert data to and from the database character set. Depending on
the character sets this may not give usable results. Conversion also adds some time overhead. If not specified, the Oracle Client
libraries determine a character set from the NLS_LANG environment variable. Passing this parameter can reduce the time taken to
connect.
o $session_mode
-This parameter is available since version PHP 5 (PECL OCI8 1.1) and accepts the following values: OCI_DEFAULT, OCI_SYSOPER and
OCI_SYSDBA. If either OCI_SYSOPER or OCI_SYSDBA were specified, this function will try to establish privileged connection using
external credentials. Privileged connections are disabled by default. To enable them you need to set oci8.privileged_connect to
On. PHP 5.3 (PECL OCI8 1.3.4) introduced the OCI_CRED_EXT mode value. This tells Oracle to use External or OS authentication,
which must be configured in the database. The OCI_CRED_EXT flag can only be used with username of "/" and a empty password.
oci8.privileged_connect may be On or Off. OCI_CRED_EXT may be combined with the OCI_SYSOPER or OCI_SYSDBA modes. OCI_CRED_EXT is
not supported on Windows for security reasons.
RETURN VALUES
Returns a connection identifier or FALSE on error.
EXAMPLES
The following demonstrates how you can separate connections.
Example #1
oci_new_connect(3) example
<?php
// create table mytab (mycol number);
function query($name, $c)
{
echo "Querying $name
";
$s = oci_parse($c, "select * from mytab");
oci_execute($s, OCI_NO_AUTO_COMMIT);
$row = oci_fetch_array($s, OCI_ASSOC);
if (!$row) {
echo "No rows
";
} else {
do {
foreach ($row as $item)
echo $item . " ";
echo "
";
} while (($row = oci_fetch_array($s, OCI_ASSOC)) != false);
}
}
$c1 = oci_connect("hr", "welcome", "localhost/orcl");
$c2 = oci_new_connect("hr", "welcome", "localhost/orcl");
$s = oci_parse($c1, "insert into mytab values(1234)");
oci_execute($s, OCI_NO_AUTO_COMMIT);
query("basic connection", $c1);
query("new connection", $c2);
oci_commit($c1);
query("new connection after commit", $c2);
// Output is:
// Querying basic connection
// 1234
// Querying new connection
// No rows
// Querying new connection after commit
// 1234
?>
See oci_connect(3) for further examples of parameter usage.
SEE ALSO
oci_connect(3), oci_pconnect(3).
PHP Documentation Group OCI_NEW_CONNECT(3)