Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6761365
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T14:10:47+00:00 2026-05-26T14:10:47+00:00

I am a .Net web developer working with a legacy Oracle database. In the

  • 0

I am a .Net web developer working with a legacy Oracle database. In the past I have worked with orm tools like nHibernate but all database communication here is required to be done via stored procedures. Our dba is asking us to pass a bunch of administrative info to every procedure we call including the username/domain/ip of the end user. This data is then used to call another stored procedure that logs usage info each time a procedure is called.

I am not that well versed in Oracle or Pl/Sql and I am trying to write my .Net code in a clean way that meets best practices whenever possible. It seems to me that this process of passing extra data through to every procedure is messy and tedious on both the .Net and Oracle ends.

Does anyone know of a better way to accomplish the dba’s goal without all the overhead? Or is this a standard way of doing things that I should get used to.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T14:10:48+00:00Added an answer on May 26, 2026 at 2:10 pm

    I’d use a context rather than passing additional parameters to every stored procedure call. A context is a convenient place to store arbitrary session-level state data that the stored procedures can all reference.

    For example, I can create a context MYAPP_CTX for my application and create a simple package that lets me set whatever values I want in the context.

    SQL> create context myapp_ctx using ctx_pkg;
    
    Context created.
    
    SQL> create package ctx_pkg
      2  as
      3    procedure set_value( p_key in varchar2, p_value in varchar2 );
      4  end;
      5  /
    
    Package created.
    
    SQL> create package body ctx_pkg
      2  as
      3    procedure set_value( p_key in varchar2, p_value in varchar2 )
      4    as
      5    begin
      6      dbms_session.set_context( 'MYAPP_CTX', p_key, p_value );
      7    end;
      8  end;
      9  /
    
    Package body created.
    

    When the application gets a connection from the connection pool, it would simply set all the context information once.

    SQL> begin
      2    ctx_pkg.set_value( 'USERNAME', 'JCAVE' );
      3    ctx_pkg.set_value( 'IP_ADDRESS', '192.168.17.34' );
      4  end;
      5  /
    
    PL/SQL procedure successfully completed.
    

    Subsequent calls and queries in the same session can then just ask for whatever values are stored in the context.

    SQL> select sys_context( 'MYAPP_CTX', 'USERNAME' )
      2    from dual;
    
    SYS_CONTEXT('MYAPP_CTX','USERNAME')
    --------------------------------------------------------------------------------
    JCAVE
    

    Realistically, you’d almost certainly want to add a clear_context procedure to the package that called dbms_session.clear_context( 'MYAPP_CTX' ) to clear whatever values had been set in the context when a connection was returned to the connection pool to avoid inadvertently allowing context information from one session to bleed over into another. You would probably also design the package with separate procedures to set and to get at least the common keys (username, ip address, etc.) rather than having ‘USERNAME’ hard-coded multiple places. I used a single generic set_value method just for simplicity.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am a web developer, have worked with PHP and .NET both. having over
I have an asp.net c# website I'm developing with Visual Web Developer Express Edition
I am a brand new Java developer (I have been working in asp.net) and
Background: I am an intermediate web app developer working on the .Net Platform. Most
For a developer who likes working in ASP.NET/Web forms, would anyone recommend going towards
I am a developer working on an ASP.Net Web Application that uses forms authentication.
I am a developer working on an internal web-based application, and I have been
I am working on a asp.net web site, like normal user, we use asp.net
During hiring a .NET web developer I give the candidate a coding test. I
I'm a .NET web developer who has just been asked to produce a small

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.