Who in a Stored Procedure
Posted in 2003
Topics: Stored Procedures & SPL, Triggers, Constraints & Referential Integrity
I need to capture the information contained in the utmp file -- that produced by, say, the UNIX "who" command -- so that I can log the user, line, time, and the "comments" (terminal name) with a trigger and stored procedure. User is easy -- is there any way to capture the rest of that data in a stored procedure? Will a stored procedure run a system command, a program (I can easily write what I need in C)? I've looked through "Answers Online" and can't find anything like this and would appreciate any advice. Thanks.
"Thomas Ronayne" <trona@ameritech.net> wrote in message news:VTDIa.508$Vx2.220145@newssvr28.news.prodigy.com... > I need to capture the information contained in the utmp file -- that > produced by, say, the UNIX "who" command -- so that I can log the user, > line, time, and the "comments" (terminal name) with a trigger and stored > procedure. > > User is easy -- is there any way to capture the rest of that data in a > stored procedure? Will a stored procedure run a system command, a > program (I can easily write what I need in C)? > > I've looked through "Answers Online" and can't find anything like this > and would appreciate any advice. Stored procedure can run system command, though it is messy. And to get back the values of that system command(C program) is even more messy. A suggestion: What you intent to capture can easily be done using sysmaster database. In the stored procedure query the sysmaster database and get all the relevant information. You can get :- 1. Informix session id. 2. name of the user. 3. The time he connected. 4. The tty(terminal) from where he connected. Ravi
rkusenet wrote: > "Thomas Ronayne" <trona@ameritech.net> wrote in message > news:VTDIa.508$Vx2.220145@newssvr28.news.prodigy.com... > >>I need to capture the information contained in the utmp file -- that >>produced by, say, the UNIX "who" command -- so that I can log the user, >>line, time, and the "comments" (terminal name) with a trigger and stored >>procedure. >> >>User is easy -- is there any way to capture the rest of that data in a >>stored procedure? Will a stored procedure run a system command, a >>program (I can easily write what I need in C)? >> >>I've looked through "Answers Online" and can't find anything like this >>and would appreciate any advice. > > > Stored procedure can run system command, though it is messy. And > to get back the values of that system command(C program) is even > more messy. > > A suggestion: What you intent to capture can easily be done using sysmaster > database. In the stored procedure query the sysmaster database and get all > the relevant information. > > You can get :- > > 1. Informix session id. > > 2. name of the user. > > 3. The time he connected. > > 4. The tty(terminal) from where he connected. > > > Ravi > > Perfect! Exactly the right hint, thank you.
You don't mention which version, but if you are on 9.x then write C function that opens the utmp file and processes the contents Thomas Ronayne wrote: > > I need to capture the information contained in the utmp file -- that > produced by, say, the UNIX "who" command -- so that I can log the user, > line, time, and the "comments" (terminal name) with a trigger and stored > procedure. > > User is easy -- is there any way to capture the rest of that data in a > stored procedure? Will a stored procedure run a system command, a > program (I can easily write what I need in C)? > > I've looked through "Answers Online" and can't find anything like this > and would appreciate any advice. > > Thanks. -- Paul Watson # Oninit Ltd # Growing old is mandatory Tel: +44 1436 672201 # Growing up is optional Fax: +44 1436 678693 # Mob: +44 7818 003457 # www.oninit.com #