473,529 Members | 2,540 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

OCILogon problem - Oracle password expiry

Hi all,

Help please.

Environment:
Unix (Tru64) / Apache / PHP4.0.6 / Oracle8i

Establish connection to Oracle:

for ($I=0; $I<$max_attempts; $I++) {
if (!$conn) {
$conn = @OCILogon($username, $password, $db);
}
}
if (!$conn) {
echo "Connection failed";
$subject = "Connection failed";
$body = "Error Message: [" . OCIError($conn) . "]";
mail($me, $subject, $headers, $body, $param);
exit;
} else {
echo "Connected!";
}

Connection appeared to have failed, but no OCIError displaying (Error
Message: []).

Discovered that the Oracle password had expired, but that I was still in
the "14 day grace period". OCI was actually returning
"OCI_SUCCESS_WITH_INFO" (the extra info being the password expiry
alert).

$conn not valid (apparently the "WITH_INFO" somehow scrambled it???),
but
a Oracle session *WAS* actually established, and eventually the DB maxed
out on session limits due to continual script retries.

Any suggestions on how best to handle this?

TIA

Geoff M
Jul 17 '05 #1
7 10993
"Geoff Muldoon" a écrit le 12/12/2003 :
Hi all, Hi

[...] $conn = @OCILogon($username, $password, $db);


The use of @ prevent from error msg as far as I know, so maybe you
cannot then retreive it via OCIError...

--
Have you read the manual?
http://www.php.net/manual/en/

Jul 17 '05 #2
je*********@free.fr.Removethis says...
"Geoff Muldoon" a écrit le 12/12/2003 :
Hi all,

Hi

[...]
$conn = @OCILogon($username, $password, $db);


The use of @ prevent from error msg as far as I know, so maybe you
cannot then retreive it via OCIError...


The @ supresses the injection of error messages into the data stream
output. Removing it made no difference to Error Message: [" . OCIError
($conn) . "].

The disply of the error message is not my main concern, rather that the
$conn session object was not set as valid, but the Oracle client session
was actually established.

Tks,

Geoff M
Jul 17 '05 #3
On Fri, 12 Dec 2003 11:52:42 +1100, Geoff Muldoon
<gm******@scu.edu.au> wrote:
Environment:
Unix (Tru64) / Apache / PHP4.0.6 / Oracle8i

Establish connection to Oracle:

for ($I=0; $I<$max_attempts; $I++) {
if (!$conn) {
$conn = @OCILogon($username, $password, $db);
}
}
if (!$conn) {
echo "Connection failed";
$subject = "Connection failed";
$body = "Error Message: [" . OCIError($conn) . "]";
mail($me, $subject, $headers, $body, $param);
exit;
} else {
echo "Connected!";
}

Connection appeared to have failed, but no OCIError displaying (Error
Message: []).

Discovered that the Oracle password had expired, but that I was still in
the "14 day grace period". OCI was actually returning
"OCI_SUCCESS_WITH_INFO" (the extra info being the password expiry
alert).

$conn not valid (apparently the "WITH_INFO" somehow scrambled it???),
but
a Oracle session *WAS* actually established, and eventually the DB maxed
out on session limits due to continual script retries.

Any suggestions on how best to handle this?


Look at:

http://bugs.php.net/bug.php?id=17448

By the looks of it, it has been "fixed" in the wrong way.

Jul 17 '05 #4
an**@andyh.co.uk says...
Discovered that the Oracle password had expired, but that I was still in
the "14 day grace period". OCI was actually returning
"OCI_SUCCESS_WITH_INFO" (the extra info being the password expiry
alert).

$conn not valid (apparently the "WITH_INFO" somehow scrambled it???),
but
a Oracle session *WAS* actually established, and eventually the DB maxed
out on session limits due to continual script retries.

Any suggestions on how best to handle this?


Look at:

http://bugs.php.net/bug.php?id=17448


Thanks for the info Andy. Unfortunately, I can't raise bugs.php.net at
the moment (web server down?? can get www.php.net). Will try again
later. Any chance you could post the bug note?

Cheers,

Geoff M
Jul 17 '05 #5
On Mon, 15 Dec 2003 14:58:14 +1100, Geoff Muldoon <gm******@scu.edu.au> wrote:
Look at:

http://bugs.php.net/bug.php?id=17448


Thanks for the info Andy. Unfortunately, I can't raise bugs.php.net at
the moment (web server down?? can get www.php.net). Will try again
later. Any chance you could post the bug note?


How about the Google cache of it:

http://66.102.11.104/search?q=cache:...hl=en&ie=UTF-8

--
Andy Hassall (an**@andyh.co.uk) icq(5747695) (http://www.andyh.co.uk)
Space: disk usage analysis tool (http://www.andyhsoftware.co.uk/space)
Jul 17 '05 #6
an**@andyh.co.uk says...
http://bugs.php.net/bug.php?id=17448
How about the Google cache of it:
http://66.102.11.104/search?q=cache:...hl=en&ie=UTF-8


Tks greatly. Agree that it is unfortunate that OCI_SUCCESS_WITH_INFO is
handled by PHP as an error, particularly as it appears that there is no
way (no valid connection handler) within PHP to terminate the existent
Oracle Client connection.

Hopefully PHP 5.0?

Cheers,

Geoff M
Jul 17 '05 #7
On Tue, 16 Dec 2003 10:17:23 +1100, Geoff Muldoon <gm******@scu.edu.au> wrote:
an**@andyh.co.uk says...
>> http://bugs.php.net/bug.php?id=17448

How about the Google cache of it:
http://66.102.11.104/search?q=cache:...hl=en&ie=UTF-8


Tks greatly. Agree that it is unfortunate that OCI_SUCCESS_WITH_INFO is
handled by PHP as an error, particularly as it appears that there is no
way (no valid connection handler) within PHP to terminate the existent
Oracle Client connection.

Hopefully PHP 5.0?


PHP's open source, patch it yourself :-)

I'd be surprised if there were no more maintenance releases of PHP 4.3. Not
sure what the process for submitting a patch to PHP is.

Just from a brief glance, looks like all you'd have to change to get it to at
least connect would be the status checks on oci_session in ext/oci/oci8.c.
There's a whole load of:

if (OCI(error) != OCI_SUCCESS) {

At least one of those - the one that can raise the password expiry warning
(OCISessionBegin?) - needs changing to:

if (OCI(error) != OCI_SUCCESS
&& OCI(error) != OCI_SUCCESS_WITH_INFO ) {

Whilst I've got the file open, may as well give it a go.

andyh@testbox:~$ sqlplus -S expiring/expiring
ERROR:
ORA-28002: the password will expire within 2 days

<pre>
<?php
putenv('ORACLE_HOME=/home/oracle/Ora92');
putenv('ORACLE_SID=dev92lnx');

if (!$oci = OCILogon("expiring", "expiring")) {
$err = OCIError();
var_dump($err);
die();
}

$stmt = OCIParse($oci, "select sysdate from dual");
OCIExecute($stmt);
OCIFetchStatement($stmt, $array);
var_dump($array);

OCILogoff($oci);

?>
</pre>

Before:
Warning: ocilogon(): OCISessionBegin: OCI_SUCCESS_WITH_INFO: ORA-28002: the
password will expire within 2 days
in /home/andyh/public_html/connect.php on line 6
array(4) {
["code"]=>
int(28002)
["message"]=>
string(50) "ORA-28002: the password will expire within 2 days
"
["offset"]=>
int(0)
["sqltext"]=>
string(0) ""
}

After applying patch at end of this message, it outputs:

Warning: ocilogon(): OCISessionBegin: OCI_SUCCESS_WITH_INFO: ORA-28002: the
password will expire within 2 days
in /home/andyh/public_html/connect.php on line 6
array(1) {
["SYSDATE"]=>
array(1) {
[0]=>
string(9) "15-DEC-03"
}
}
It seemed the right thing to do to output the warning; all I've done is
avoided it aborting entirely. Patch follows:

*** oci8.c.orig Mon Dec 15 23:39:42 2003
--- oci8.c Mon Dec 15 23:43:49 2003
***************
*** 2321,2326 ****
--- 2321,2327 ----

if (OCI(error) != OCI_SUCCESS) {
oci_error(OCI(pError), "OCISessionBegin", OCI(error));
+ if (OCI(error) != OCI_SUCCESS_WITH_INFO)
goto CLEANUP;
}

--
Andy Hassall (an**@andyh.co.uk) icq(5747695) (http://www.andyh.co.uk)
Space: disk usage analysis tool (http://www.andyhsoftware.co.uk/space)
Jul 17 '05 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
2055
by: arun.kumar.varma | last post by:
Hi, My objective is to try to connect to the oracle database and if an error occurs go to another page. The code follows $conn = OCILogon($user,$passwd,$db); // <---- Line 34 if (!$conn) { $err = OCIError(); header("Location: dbproblem.php?error=$err");
0
1281
by: Lim Eng Teik | last post by:
I was asked by a client to make changes for their Outlook Web Access page where I need to validate Expiry Date of the Password and also the Password Length for the NT Account Policy. Initially I use javascript to do a static validation for the password expiry and password length. There request now include dynamic changes to the Javascript...
4
19969
by: susmita_ganguly | last post by:
Hi I am trying to upgrade from oracle 8i to oracle 9i on the same server ..I don't know much abt migration . Can anyone help me out. Thanks. Susmita
0
4729
by: JWM | last post by:
I am trying to implement Oracle connection pooling for the following code, which was written by someone else. Here is my main question -- this java file creates code that is executed every hour, but once per week, the oracle server is brought down for backup. At that time, I get an error that looks like I have the wrong credentials for the...
3
24263
by: David Gray | last post by:
Hello all, Having problems connecting to an Oracle 9i database from within SQL/Server 2000 using the Security/Linked Servers feature. Server1 (SQL/Server) ----------- Windows Server 2003, Standard edition MS SQL/Server 2000 Oracle 9i Client kit (OLEDB & ODBC) & Enterprise management tools
2
25803
by: JuliouZ | last post by:
Warning: ocilogon() : OCIEnvNlsCreate() failed. There is something wrong with your system - please check that ORACLE_HOME is set and points to the right directory in /web/htdocs/test.php on line 6 Oracle Connect Error my file test.php : <?php PutEnv("ORACLE_SID=TEST"); PutEnv("ORACLE_HOME=/oracle/ora102");...
0
1492
by: vaidehi | last post by:
hi all!! pls help me.. in /etc/login.defs, changed PASS_MAX_DAYS value from 99999 to 30 PASS_MAX_DAYS 30 PASS_MIN_DAYS 0 PASS_WARN_AGE 7 after this if I create a user, his password will expire after 30 days. But existing users' passwords do not have any expiry date.. so they will...
1
4042
by: Akino877 | last post by:
Hello, I am writing a simple PHP script to see if I can make a connection to my Oracle database. And it showed that my call to OCILogon() failed. But my call to OCIError() returned "False", which I believe meant to be "no error found". I wonder if you could please help me get additional information as to why my call to OCILogon()...
3
6580
by: ragonz | last post by:
i tried to execute php file from cmd line. i'm using xampp version 1.67 with windows server 2003 as the OS. it'll also include oracle as the database,which means OCILogon() will be called in my php file and so other functions. i already configured the php.ini so that it connects to oracle. in web page, i can access the database(oracle). But the...
0
7333
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7258
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7661
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7244
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
5790
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5189
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
4826
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3322
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1708
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.