Groups > Databases > Oracle for ASP.NET > Re: Knowing the user in the database




Knowing the user in the database

Knowing the user in the database
Wed, 2 Apr 2008 14:51:11 +0000
Hi,

 

I am developing an ASP.NET application. The database is gonna be Oracle 10.2. I
want to use only one user account to connect the webserver with the database. Is
it any way of knowing in the database the user who is doing an update, delete,
insert or select without passing it explicitly as parameter.

 

Regars,

Franco
Post Reply
Re: Knowing the user in the database
Wed, 2 Apr 2008 15:24:40 +0000
Well you set the user( login) in the connection string and use the connection
string to instantiate a connection object. This way all connections from your
application will be associated with that login
Post Reply
Re: Knowing the user in the database
Wed, 2 Apr 2008 16:21:05 +0000
Sorry, my message was a bit ambigous. I want to know the different users from
the web that are doing a specific request, transaction, whatever, in the
database without passing it as parameter explicitly of the stored procedures
each time.
Post Reply
Re: Knowing the user in the database
Wed, 2 Apr 2008 16:52:24 +0000
I am not sure what Oracle has in terms of profiling.But if you profile a sql
server database you can gather this information.
Post Reply
Re: Knowing the user in the database
Thu, 3 Apr 2008 04:24:45 +0000
It's still not clear what you're trying to do.

You need to specify what this "user" is- An Oracle DBMS user? An AD
user?
 

If you want to know which ORACLE user is doing a transaction, you can simply use
"USER"- for example: "SELECT user FROM DUAL;" or
"INSERT INTO table VALUES('parameter1',USER);"
 

If you don't want the user inserted as a parameter in your INSERT statements,
but you still want a column in the table to keep track of who inserted the
record in each individual table, you could use a trigger containing something
similar to:

IF :new.user IS NULL THEN

   :new.user := USER;

END IF;

 

If you are wanting to audit transactions within the database, there are a number
of solutions- the best thing to do would be to google "oracle
auditing". It depends on the extent of what you need audited.

 

If you're wanting to keep track of a web user making transactions through one
database schema.. I would pass through the user as a variable- as you are. I
can't think of any simple way to do it otherwise. .NET is just a client like
SQL*Plus.
Post Reply
<< Previous 1 2 Next >>
( Page 1 of 2 )
about | contact