0

The PHP function oci_connect (which connects to an Oracle database) just returns false if it fails, which at the moment I handle like this:

$connection = oci_connect($username, $password, $database);
if (!$connection){
    return $result = "Trouble connecting to the Oracle Database";
}

But really I'd like to have the actual ORA error code, so I can be more informative. Is this possible?

1 Answer 1

1

Have you tried examining the results of oci_error()?

I haven't used Oracle with PHP (sadly) but the MySQL the general pattern is:

if (!mysql_connect(...)) {
  error_log('Error connecting: ' . mysql_error()); // or just die
}

It seems logical that the Oracle pattern would be:

if (!oci_connect(...)) {
  error_log('Error connecting: ' . oci_error());
}
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.