DBAsupport.com Forums - Powered by vBulletin
Results 1 to 10 of 10

Thread: PHP and ORA-03120

  1. #1
    Join Date
    Nov 2000
    Location
    greenwich.ct.us
    Posts
    9,092

    PHP and ORA-03120

    I have a PHP script that runs from my webserver. The script is being run as a
    CGI script. This script connects to the database using OCI, retrieves 3
    records from a one column table, and then disconnects.

    db1.us and db2.us are hosted on the same Solaris box. Both dbs have the same
    $ORACLE_HOME. I created the same user and same table on both databases.

    When the script connects to db1.us, no problem, it retrieves the data and
    displays it like I want. When the script runs against db2.us, it connects to
    the database and gets a "ORA-03120: two-task conversion routine: integer
    overflow" error.

    Obviously, something is different between the two dbs, but I don't have a clue of what to look for.

    PHP Code:
    <html>
    <p>Oracle DB Test</p>
    <?php

       Putenv
    ("ORACLE_HOME=/usr/local/oracle");

       
    $db=OCILogon("jeffh","jeffh""db1.us");
       if ( 
    $db == false ) {
          
    $err OCIError();
          
    $err_code $err['code'];
          
    $err_message $err['message'];
          echo 
    $err_code;
          echo 
    $err_message;

      echo <<<ERROR_MESSAGE
      <table border="1" cellpadding="0" cellspacing="0" bordercolor="red">
        <tr>
          <th colspan="2">The Following Error Has Occured!</th>
        </tr>
        <tr>
          <th>Code</th>
          <th>Message</th>
        </tr>
        <tr>
          <td>
    $err_code</td>
          <td>
    $err_message</td>
        </tr>
      </table>
    ERROR_MESSAGE;

          exit;
       }

       
    $sql="select x from xyz";
       
    $cur OCIParse($db$sql);
       if (
    OCIError() != false ) {
          
    $err OCIError();
       
          
    $err_code $err['code'];
          
    $err_message $err['message'];

          echo <<<ERROR_MESSAGE
             <table border="1" cellpadding="0" cellspacing="0" bordercolor="red">
               <tr>
                  <th colspan="2">The Following Error Has Occured!</th>
               </tr>
               <tr>
                  <th>Code</th>
                  <th>Message</th>
               </tr>
               <tr>
                  <td>
    $err_code</td>
                  <td>
    $err_message</td>
               </tr>
            </table>
    ERROR_MESSAGE;
       exit;
       }


       
    $res OCIExecute($cur);
       if (
    $res == false ) {
          echo 
    "error executing...";
          
    $err OCIError($cur);
       
          
    $err_code $err['code'];
          
    $err_message $err['message'];

          echo <<<ERROR_MESSAGE
             <table border="1" cellpadding="0" cellspacing="0" bordercolor="red">
               <tr>
                  <th colspan="2">The Following Error Has Occured!</th>
               </tr>
               <tr>
                  <th>Code</th>
                  <th>Message</th>
               </tr>
               <tr>
                  <td>
    $err_code</td>
                  <td>
    $err_message</td>
               </tr>
            </table>
    ERROR_MESSAGE;

          exit;
       }

       echo 
    "<table border=1>";
       echo 
    "<tr><td><b>name</b></td></tr>";
       
       while (
    OCIFetchInto($cur$values)) {

          echo 
    "<tr><td><b>$values[0]</b></td></tr>";
       }

       echo 
    "</table>";

       
    OCILogoff($db);

    ?>
    </html>
    Jeff Hunter

  2. #2
    Join Date
    Nov 2000
    Location
    Pittsburgh, PA
    Posts
    4,166
    This is just a guess but have you thought about unsetting two_task?
    You don't need to use TWO_TASK to connect to a database.
    I have seen issues with TWO_TASK and running shell scripts,
    which may or may not relate to your issue.

  3. #3
    Join Date
    Nov 2000
    Location
    greenwich.ct.us
    Posts
    9,092
    TWO_TASK is not set.
    Jeff Hunter

  4. #4
    Join Date
    Nov 2000
    Location
    Pittsburgh, PA
    Posts
    4,166
    I'm sure you have already looked up the ORA-03120 error, but are you retrieving more than 32k of data from the database causing the TWO_TASK error?

    Have you tried setting TWO_TASK?

  5. #5
    Join Date
    Nov 2000
    Location
    greenwich.ct.us
    Posts
    9,092
    Originally posted by gandolf989
    I'm sure you have already looked up the ORA-03120 error, but are you retrieving more than 32k of data from the database causing the TWO_TASK error?

    Have you tried setting TWO_TASK?
    I'm only retrieving about 40 bytes of data. I have tried all sorts of incarnations of TWO_TASK without luck.
    Jeff Hunter

  6. #6
    Join Date
    Nov 2000
    Location
    Pittsburgh, PA
    Posts
    4,166
    This might be nitpicking but you have the same error message three times in your code without identifiying exactly where the error is happening.

    Rather than using a generic message like this:
    The Following Error Has Occured!

    Try more specific error messages like these:

    Unable to log on due to error:
    Error parsing query:
    Error executing query:

    This might be as simple as a lack of permissions.
    Last edited by gandolf989; 11-10-2004 at 02:50 PM.

  7. #7
    Join Date
    Nov 2000
    Location
    greenwich.ct.us
    Posts
    9,092
    This is just a simplified example.
    Jeff Hunter

  8. #8
    Join Date
    Sep 2001
    Location
    Makati, Philippines
    Posts
    857
    If i'm not mistaken Jeff,
    it is the external procedure that is not properly
    configured in your SID_LIST_LISTENER in LISTENER.
    usually an OCI program uses the extproc program,
    which is also found in the ORACLE_HOME dir where in the db resides.
    In your case, i think there must be a separate SID_DESC, since you have two database.

    I hope i'm right, and that it can help.

  9. #9
    Join Date
    Nov 2000
    Location
    greenwich.ct.us
    Posts
    9,092
    Originally posted by reydp
    If i'm not mistaken Jeff,
    it is the external procedure that is not properly
    configured in your SID_LIST_LISTENER in LISTENER.
    usually an OCI program uses the extproc program,
    which is also found in the ORACLE_HOME dir where in the db resides.
    In your case, i think there must be a separate SID_DESC, since you have two database.

    I hope i'm right, and that it can help.
    My webserver is a different host than my dbserver. I am not trying to call PHP from Oracle, but trying to get results back from Oracle to PHP.
    Jeff Hunter

  10. #10
    Join Date
    Nov 2000
    Location
    greenwich.ct.us
    Posts
    9,092
    I tracked this down to a NLS Character Set issue. On databases setup with US7ASCII as their character set, the PHP script works fine. On databases with the character set WE8ISO8859P1, the ORA-03120 was produced. I cloned the subject database and changed the character set to US7ASCII and the PHP works fine now.
    Jeff Hunter

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Click Here to Expand Forum to Full Width