Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

PHP and oracle help PLZ....

  • 10-03-2006 3:34pm
    #1
    Registered Users, Registered Users 2 Posts: 2,073 ✭✭✭


    looking to connect to oracle 9i and view background and user trace files
    [url=http://www.oracle.com/technology/pub/articles/gallagher_tfm.html [/url]
    http://www.oracle.com/technology/pub/articles/gallagher_tfm.html
    PHP and apache have been configured and do connect
    $_SESSION
    $_SESSION
    $_SESSION
    The above has been specified ...............

    Im getting this error :
    What do I need to specify ?
    Any suggestions would be great !

    Warning: ocilogon() [function.ocilogon]: ORA-12533: TNS:illegal ADDRESS parameters in C:\oracle\ora92\Apache\Apache\htdocs\listFiles.php on line 22

    Warning: ociparse() expects parameter 1 to be resource, boolean given in C:\oracle\ora92\Apache\Apache\htdocs\retrieveTraceFile.php on line 70

    Warning: ociexecute() expects parameter 1 to be resource, null given in C:\oracle\ora92\Apache\Apache\htdocs\retrieveTraceFile.php on line 74

    Warning: ociparse() expects parameter 1 to be resource, boolean given in C:\oracle\ora92\Apache\Apache\htdocs\retrieveTraceFile.php on line 77

    Warning: ociexecute() expects parameter 1 to be resource, null given in C:\oracle\ora92\Apache\Apache\htdocs\retrieveTraceFile.php on line 79

    Warning: ocifetchstatement() expects parameter 1 to be resource, null given in C:\oracle\ora92\Apache\Apache\htdocs\retrieveTraceFile.php on line 81
    :confused::confused::confused:

    PHP............................................... ...........

    ;<?php
    session_start();
    echo "<html><head><title>Trace File Manager</title></head><body>";
    echo"<link rel=\"stylesheet\" href=\"../css/tfd.css\" type=\"text/css\">";
    $mode = $_REQUEST;
    if ( $mode == 'START')
    {
    $_SESSION = $_REQUEST;
    $_SESSION = $_REQUEST;
    $_SESSION = $_REQUEST;
    }

    $db = "(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP )(HOST = " . $_SESSION[D2Y8732J] .
    ")(PORT=" . $_SESSION[1521] .
    "))) (CONNECT_DATA=(SID = " . $_SESSION[***] .
    ")))";
    $db_conn = OCILogon($_SESSION, $_SESSION, $db);
    $_SESSION = $db;
    if ( $mode == 'TKP')
    {
    $cmdstr = "begin pack_trace_file_manager.pc_generate_prf ("
    . "'" . $_REQUEST . "',"
    . "'" . $_REQUEST . "',"
    . "'" . $_REQUEST . "',"
    . "'" . $_REQUEST . "',"
    . "'" . $_REQUEST . "',"
    . "'" . $_SESSION . "',"
    . "'" . $_SESSION . "',"
    . "'" . $_REQUEST . "'); end;";
    $parsed = ociparse($db_conn, $cmdstr);
    ociexecute($parsed);
    }
    if
    ( $_REQUEST == 'TRUE')
    {
    if
    ( $_REQUEST == 'BACKGROUND')
    {
    for ($i = 0; $i < sizeof($_SESSION); $i++ )
    {
    $cmdstr = "begin pack_trace_file_manager.pc_delete_files('" . $_REQUEST . "','" . $_SESSION[$i] . "'); end;";
    $parsed = ociparse($db_conn, $cmdstr);
    ociexecute($parsed);
    }

    }

    else
    {
    for ($i = 0; $i < sizeof($_SESSION); $i++ )
    {
    $cmdstr = "begin pack_trace_file_manager.pc_delete_files('" . $_REQUEST . "','" . $_SESSION[$i] . "'); end;";
    $parsed = ociparse($db_conn, $cmdstr);
    ociexecute($parsed);
    }
    for ($i = 0; $i < sizeof($_SESSION); $i++ )
    {
    $cmdstr = "begin pack_trace_file_manager.pc_delete_files('" . $_REQUEST . "','" . $_SESSION[$i] . "'); end;";
    $parsed = ociparse($db_conn, $cmdstr);
    ociexecute($parsed);
    }
    }

    }

    $cmdstr = "begin pack_trace_file_manager.pc_generate_file_list('" . $_REQUEST . "'); end;";
    $parsed = ociparse($db_conn, $cmdstr);
    ociexecute($parsed);

    if
    ( $_REQUEST == 'USER')
    {
    echo "<form action=\"deleteFilesConfirmation.php\" method=\"post\">";
    $cmdstr = "select trc_file_name,trc_file_tstamp,prf_file_name,prf_fi le_tstamp from vw_tfm_filelist";
    $parsed = ociparse($db_conn, $cmdstr);

    ociexecute($parsed);

    $nrows = ocifetchstatement($parsed, $results);
    echo "<center><table class='noBorders' width='80%'>\n<tr>\n";
    echo "<tr>\n";
    echo "<td class='noBorders'><h2>Available User Trace Files for > " . $_SESSION . " < </h2></td><br>";
    echo "<td class='noBorders'><h2><div style=\"text-align:right\"><a href=\"listTargets.php\">Back to the List of Target Databases</a></div></h2></td><br>";
    echo "</tr></table>";
    echo "<br><br>";
    echo "<center><table width='80%'><center>\n<tr>\n";
    echo "<td><b>Raw Trace File Name</b></td>\n<td><b>Raw Trace File Timestamp</b></td>\n<td><b>SRT</td>\n<td><b>TKP</td>\n<td><b>Formatted Trace File Name</b></td>\n<td><b>Formatted Trace File Timestamp</b></td>\n<td><b>SFT</td>\n<td align=center>Delete</td>\n</tr>\n";

    $_SESSION = $results["TRC_FILE_NAME"];
    $_SESSION = $results["PRF_FILE_NAME"];
    for ($i = 0; $i < $nrows; $i++ )
    {
    echo "<tr>\n";
    echo "<td>" . $results["TRC_FILE_NAME"][$i] . "</td>";
    echo "<td>" . $results["TRC_FILE_TSTAMP"][$i] . "</td>";
    echo "<td><a href=\"retrieveTraceFile.php?mode=TRACE&dest=USER& trcFileName=" . $results["TRC_FILE_NAME"][$i] .
    "\"> SRT </a></td>";
    echo "<td><a href=\"tkprofDialog.php?traceFileName=" . $results["TRC_FILE_NAME"][$i] .
    "\"> TKP </a></td>";

    if ( $results["PRF_FILE_NAME"][$i] == '')
    {
    echo "<td>.</td>";
    echo "<td>.</td>";
    echo "<td>.</td>";
    }
    else
    {
    echo "<td>" . $results["PRF_FILE_NAME"][$i] . "</td>";
    echo "<td>" . $results["PRF_FILE_TSTAMP"][$i] . "</td>";
    echo "<td><a href=\"retrieveTraceFile.php?mode=TRACE&dest=USER& trcFileName=" . $results["PRF_FILE_NAME"][$i] .
    "\"> SFT </a></td>";
    }
    echo "<td align=center><input type=checkbox name=fileDelete" . $i . " value=YES></td>";
    echo "</tr>\n";
    }
    echo "<input type=\"hidden\" name=\"dest\" value=\"USER\">";
    echo "<tr><td colspan='6'> Number of Files : $nrows</td><td align=center>Delete All</td><td align=center><input type=checkbox name=deleteAll value=YES></td></tr>";
    echo "<tr><td colspan='7'></td><td align=center> <input type=\"submit\" value=\"Delete\"> </td></tr>";
    echo "</table>";
    }
    else
    {
    echo "<form action=\"deleteFilesConfirmation.php\" method=\"post\">";
    $cmdstr = "select file_name trc_file_name,file_tstamp trc_file_tstamp from tfm_filelist";
    $parsed = ociparse($db_conn, $cmdstr);

    ociexecute($parsed);

    $nrows = ocifetchstatement($parsed, $results);
    echo "<center><table class='noBorders' width='80%'>\n<tr>\n";
    echo "<tr>\n";
    echo "<td class='noBorders'><h2>Available Background Trace Files for > " . $_SESSION . " < </h2></td><br>";
    echo "<td class='noBorders'><h2><div style=\"text-align:right\"><a href=\"listTargets.php\">Back to the List of Target Databases</a></div></h2></td><br>";
    echo "</tr></table>";

    echo "<br><br>";
    echo "<center><table width='80%'><center>\n<tr>\n";
    echo "<td><b>Trace File Name</b></td>\n<td><b>Trace File Timestamp</b></td>\n<td></td><td align=center>Delete</td>\n</tr>\n";

    $_SESSION = $results["TRC_FILE_NAME"];
    for ($i = 0; $i < $nrows; $i++ )
    {
    echo "<tr>\n";
    echo "<td>" . $results["TRC_FILE_NAME"][$i] . "</td>";
    echo "<td>" . $results["TRC_FILE_TSTAMP"][$i] . "</td>";
    echo "<td align=center><a href=\"retrieveTraceFile.php?mode=TRACE&dest=BACKG ROUND&trcFileName=" . $results["TRC_FILE_NAME"][$i] .
    "\"> SRT </a></td>";
    echo "<td align=center><input type=checkbox name=fileDelete" . $i . " value=YES></td>";

    }
    echo "<br><br>";

    echo "<input type=\"hidden\" name=\"dest\" value=\"BACKGROUND\">";
    echo "<tr><td colspan='2'> Number of Files : $nrows</td><td align=center>Delete All</td><td align=center><input type=checkbox name=deleteAll value=YES></td></tr>";
    echo "<tr><td colspan='3'></td><td align=center> <input type=\"submit\" value=\"Delete\"> </td></tr>";
    echo "</table>";

    }




    ?>;


Comments

  • Closed Accounts Posts: 169 ✭✭akari no ryu


    Ever thought about using a database abstraction tool?
    Personally, I don't use any of the direct interfaces to databases in PHP. I use AdoDB. Configure once, use many times.


  • Registered Users, Registered Users 2 Posts: 32,136 ✭✭✭✭is_that_so


    Have you tested the TNS entry to see if it actually works? TNS errors of that sort usually suggest a problem with the TNS entry.

    Also verify that any user input that is being fed into the oci commands is actually being passed.

    By the looks of things "$db_conn" is not getting anywhere because of problems with "$db" which in turn is affectd by the TNS error you encountered thus leading to your errors with the oci commands.

    Can't beat loads of "print $var" or "echo $var" statements for debugging.


  • Registered Users, Registered Users 2 Posts: 2,073 ✭✭✭homer90


    Cheers guys ....
    Its no big deal its just something Im playing around with at home....
    Having said that I would like to get it working!!


Advertisement