How to set Program Name / How to detect a KILL

How to set Program Name / How to detect a KILL

Post by Christian Conve » Sat, 06 Apr 2002 22:42:13



Hi guys,
I've got two questions I'd appreciate help with...

(1) If / how, using JDBC, can one set the value that appears in sp_who2's
"ProgramName" column?

(2) If / how, using JDBC, can one detect that a stored procedure invocation
in JDBC was terminated using T-SQL's "KILL <spid>" command?

Thanks in advance,
Christian

 
 
 

How to set Program Name / How to detect a KILL

Post by Joseph Weinstei » Wed, 10 Apr 2002 02:34:01



> Hi guys,
> I've got two questions I'd appreciate help with...

> (1) If / how, using JDBC, can one set the value that appears in sp_who2's
> "ProgramName" column?

This would be driver-specific, as the program name is not generic to JDBC or
DBMSes. In the case of the MS driver, you cannot do this.

Quote:> (2) If / how, using JDBC, can one detect that a stored procedure invocation
> in JDBC was terminated using T-SQL's "KILL <spid>" command?

Impossible. Once the DBMS kills the connection, the JDBC driver will only find
out by failing to accomplish what it tries next, and it may not even see or be able
to parse anything sent to the client by the DBMS, which is usually nothing anyway.

sorry,
Joe Weinstein at B.E.A.

 
 
 

How to set Program Name / How to detect a KILL

Post by Christian Conve » Wed, 10 Apr 2002 03:02:11


Thanks for the info Joe. It's not the answer I hoped for, but at least I
know to work around it.

- Christian



> > Hi guys,
> > I've got two questions I'd appreciate help with...

> > (1) If / how, using JDBC, can one set the value that appears in
sp_who2's
> > "ProgramName" column?

> This would be driver-specific, as the program name is not generic to JDBC
or
> DBMSes. In the case of the MS driver, you cannot do this.

> > (2) If / how, using JDBC, can one detect that a stored procedure
invocation
> > in JDBC was terminated using T-SQL's "KILL <spid>" command?

> Impossible. Once the DBMS kills the connection, the JDBC driver will only
find
> out by failing to accomplish what it tries next, and it may not even see
or be able
> to parse anything sent to the client by the DBMS, which is usually nothing
anyway.

> sorry,
> Joe Weinstein at B.E.A.

 
 
 

1. Detecting program name on logon.

I have a program that constantly connects to the database and hangs
resources
for the database. It is using JDBC client, so all information in
V$SESSION is non-specific (there is no terminal, os_user or any other
fields). It is also using generic user name that other programs use.
All I have to go by is the external program name (it says ORACLE.EXE
(P001)). I wanted to come up with the after logon trigger that would
disconnect session with such a program name.
However, in the userenv there is no program name attribure, there is
also no sessionid so that I can reference V$SESSION.
ANy ideas on how I can do that?
Thanks.

2. HELP! Need to run query based on user input

3. How to detect that a KILL occured?

4. Microsoft vs. Intershop --who wins? DUH!

5. how to detect a killed database connection?

6. MS Jet 4.0 - bug or behavior by design?

7. detecting / killing inactive connections?

8. WebDB Installation problem (OWA40.vrf(93))

9. Setting up HOSTNAME dans C program Embedded SQL/C Program

10. Program to set up tags for INFORMIX-4gl program

11. program name and host name in sysprocesses table

12. Retrieve Named Sets names

13. Named set (CREATE SET) with Pivot Table