No announcement yet.

Audit on Oracle DB Connection

  • Filter
  • Time
  • Show
Clear All
new posts

  • Audit on Oracle DB Connection

    I want to activate journaling on db modifications from scriptcase app.
    On plain PHP I use:
    oci_set_client_identifier($conn, $user);
    to associate user and connection. How can I do the same with scriptcase? Which is the name of the connection to put instead of $conn?
    Thank You.

    P.S.: I know that scriptcase has a integrated logging system, but I need to have it directly on db from triggers.

  • #2
    No one has the solution? I need only to know how to refer to the connection in scriptcase...


    • #3
      well the connection is actually to be found in your application.php name. So if your app is named myapp then myapp.php holds your connection.
      In the first lines you see:
      $_SESSION['scriptcase']['myapp']['glo_nm_perfil']='conn_oracle' (or however you named your connection).
      There you see the name of your connection back.
      Technically if you look a bit further in the code you see db_conect_devel($con_devel, $this->root . $this->path_prod, .... hence $con_devel is probably the one you need to use.
      Be aware these are educated guesses, you need to do some debugging to find out the details. What actually happens can be quickly seen in the generated source codes.


      • #4
        $con_devel, like $_SESSION['scriptcase']['myapp']['glo_nm_perfil'], contains only the string "conn_oracle" and not the connection... so still no solution... :-(

        Update: I find that $this->Db maybe contains the connection... but I don't understand how exactly recall it...
        Last edited by insecta; 01-21-2015, 11:49 AM.


        • #5
          for others use, this is the solution:
          put this line in your onScriptInit:
          $this->Db->Execute("begin DBMS_SESSION.SET_IDENTIFIER('$user'); end;");


          • #6
            Good one, I had not thought about that.